Compare commits

..

285 Commits

Author SHA1 Message Date
Jinwon Kim c6179c24ed [netif] fix bug in print statement with no corresponding argument (#8353) 2022-11-02 00:16:53 -07:00
Abtin Keshavarzian ac11f66419 [log] add compile-time check for printf style arg check to log functions (#8339)
This commit adds compile-time check of format string to all log
functions and macros. It also updates different core modules to make
arg string formats consistent under different platforms. In particular
we use `'%lu` for `uint32_t` arguments and they are explicitly cast
to `unsigned long` using `ToUlong()`.
2022-11-01 22:45:16 -07:00
Abtin Keshavarzian f5acfb2dac [cli] update CLI Output class (#8343)
This commit updates the `Cli::Output` class and the related types. A
new type `OutputImplementer` is added which provides the basic output
functionality, i.e., method `OutputV()`. `Output` class requires a
reference to an `OutputImplementer` which it then uses to provide all
the different `Output{}()` method flavors. The new model allows all
CLI sub-modules to directly inherit `Output` class while reusing a
single and common underlying `OutputImplementer` provided by the
`Cli::Interpreter`.
2022-11-01 13:28:37 -07:00
Zhanglong Xia 11a24d111f [diag] add gpio diag command support (#8316) 2022-10-31 17:05:20 -07:00
Abtin Keshavarzian 1d1e5d16e0 [cli] enhance parsing of flags for route commands (#8340)
This commit enhances `ParseRoute()` method allowing flags to be
specified in one arg (sequence of char indicating different flags) or
potentially over different args. This commit also allows `-` to be
used in `route` or `prefix` commands to indicate empty flag.
2022-10-28 16:04:59 -07:00
Suvesh Pratapa 778e3b9ead [netif] fix bug in print statement (#8338) 2022-10-28 15:55:58 -07:00
Abtin Keshavarzian ca8799a4b8 [routing-manager] persist deprecating old prefixes in Settings (#8330)
This commit adds mechanism to save deprecating old on-link prefixes
in non-volatile `Settings`. With this, if the BR is restarted, it
will remember the old prefixes and keep deprecating them (advertising
them in emitted RA and publish them in Thread Network Data).

This commit also adds `TestSavedOnLinkPrefixes()` test case in
`test_routing_manager` to cover the behavior of the newly added
mechanism.
2022-10-27 15:12:59 -07:00
Jonathan Hui b9b9c19640 [network-data] do not process TMF messages if waiting for sync (#8332) 2022-10-27 02:08:56 -07:00
Abtin Keshavarzian 2a5a926952 [mle] log sending of "Link Accept and Request" (#8328)
This commit update `SendLinkAccept()` method so to log the message type
(whether we send "Link Accept and Request" or "Link Accept").
2022-10-27 02:08:36 -07:00
Abtin Keshavarzian d4d872c05c [test] increase wait time after ether re-enable (#8322)
This commit increases the wait time in `test_single_border_router`
after re-enabling `ether` link. It also changes the order of pings
in the test (first ping from host to Thread router and the opposite
direction).
2022-10-27 02:07:30 -07:00
Yaoxing Shan 2592e3433a [tcplp] fix call to tcplp_sys_accept_ready() (#8327)
aAddr should be the source address not the destination address.
2022-10-26 04:38:25 -07:00
Abtin Keshavarzian ed31bfefb6 [address-resolver] allow addr resolution using net data service (#8318)
This commit implements a new optimization in `AddressResolver`
allowing it to resolve on-mesh IPv6 addresses using info from Thread
Network Data DNS/SRP Service (Unicast Address) entries.

When determining EID-to-RLOC mapping in `Resolve()`, we first try to
match the EID against unicast addresses discovered from DNS/SRP
service entries. This is limited to entries where the address/port
info is encoded as part of server data. If a match is found the
associated RLOC16 of the BR which added the entry in Network Data
will be used (i.e., the `server16` field from Network data server
sub-TLV). This optimization is used on devices where MLE Mode
indicates they receive full Network Data and not the stable subset
(since stable subset will not provide RLOC16 info).

This commit adds a similar check in `UpdateSnoopedCacheEntry()` so
that the limited snoop cache entries are not unnecessarily used for
addresses which can be resolved using Network Data services.
2022-10-26 01:37:40 -07:00
Abtin Keshavarzian 53305d4762 [routing-manager] add Neighbor Solicit probe mechanism (#8090)
This commit adds a new mechanism in `RoutingManager` to periodically
check that discovered routers are still active and operational, so
that if the router providing the favored on-link prefix becomes
offline, we can detect it more quickly (instead of waiting for the
prefix lifetime to expire) and then the BR can start advertising its
own on-link prefix.

Receiving a Router or Neighbor Advertisement message from a router
indicates that it is active. After a timeout interval passes from the
last receive from a router we start sending Neighbor Solidification
(NS) probes to it. This timeout interval can be specified by newly
added build-time OT config parameter (default value is set to one
minute). If no response is received after multiple NS attempts, the
router is considered to be inactive and the discovered prefix entries
associated with the router are removed or deprecated.

This commit also updates the unit test for routing manager to validate
the behavior of the newly added mechanism.
2022-10-25 00:04:47 -07:00
Seth Rickard b7471733c5 [mac] add reserved value to source address parsing (#8326)
Fails packet parsing if the reserved value is found in the source
addressing field instead of marking the address as "none".
2022-10-24 15:07:34 -07:00
Zang MingJie e4bf2ffe34 [netif-posix] add an option to persistent interface (#8033) 2022-10-24 14:57:48 -07:00
Abtin Keshavarzian d1653a8edc [routing-manager] new mechanism for deprecating old on-link prefixes (#8315)
This commit updates how `OnLinkPrefixManager` retains and deprecates
old local on-link prefixes. Instead of remembering a single old
prefix, a list of old prefixes are remembered and the number of
entries in the list can be configured at build-time using an OT
config.

If the BR is stopped, the deprecating prefixes are still remembered
and the the expire timer keeps running. They are removed from the
list when they expire. If the BR is started again the deprecating old
prefixes are again included as PIO in the emitted RA and also
published in Network Data.

The changes in this commit also ensure we can correctly handle the
situation where the extended PAN ID is changed to a previous value
before the corresponding on-link prefix expires, i.e. when a
currently deprecating prefix becomes the current local on-link prefix
again.

This commit also updates the unit test case validating the behavior of
newly added mechanism under different situations.
2022-10-21 21:27:57 -07:00
Abtin Keshavarzian ed43da9110 [routing-manager] new mechanism for deprecating old on-link prefixes (#8315)
This commit updates how `OnLinkPrefixManager` retains and deprecates
old local on-link prefixes. Instead of remembering a single old
prefix, a list of old prefixes are remembered and the number of
entries in the list can be configured at build-time using an OT
config.

If the BR is stopped, the deprecating prefixes are still remembered
and the the expire timer keeps running. They are removed from the
list when they expire. If the BR is started again the deprecating old
prefixes are again included as PIO in the emitted RA and also
published in Network Data.

The changes in this commit also ensure we can correctly handle the
situation where the extended PAN ID is changed to a previous value
before the corresponding on-link prefix expires, i.e. when a
currently deprecating prefix becomes the current local on-link prefix
again.

This commit also updates the unit test case validating the behavior of
newly added mechanism under different situations.
2022-10-21 21:27:35 -07:00
Tobías Lifschitz 8c73c9747b [mle] add time tracking to mle roles (#8312)
A useful metric for a device is the amount of time it spends in each
mle role. This could help to identify connectivity issues on SED with
weak signal and frequent detaches by checking the time spent in
detached mode. It would also be useful to know the time spent in
leader state when having multiple FTDs frequently joining and
splitting in different partitions.

This information is not available from the role counters, since time
spent in each state is not related to the number of entries to that
state.

This commit adds mle counters to track time spent in each role, when
uptime feature is enabled (`OPENTHREAD_CONFIG_UPTIME_ENABLE=1`).
2022-10-21 21:26:41 -07:00
Abtin Keshavarzian c3bb95d5f4 [string] add compile-time check for printf style arg consistency (#8277)
This commit adds `OT_TOOL_PRINTF_STYLE_FORMAT_ARG_CHECK` macro in
`toolchain.h`. It specifies that a function or method takes `printf`
style args. It asks the compiler to check the args for consistency
with the passed-in format string.

The commit uses the new macro in `String::Append()` and its uses are
updated to ensure consistency between format string and the args.
2022-10-21 16:26:21 -07:00
Tom Rebbert acf44c45cd [mac] Bugfix: Messages without a source address handled incorrectly (#8321)
When a message is received that does not contain a source address (ex:
IEEE 802.15.4 Beacon Request) find neighbor should not be called to
attribute the message to a particular device in the network.

The bug was found in the following scenario:
* Network operating with REED devices.
* Other non-Thread IOT devices in the space periodically sending
  beacon requests.
* Note that the REED devices have unexpectedly low average RSSI values
  for their parents.

When the child processes the beacon request, it calls FindNeighbor(),
which defaults to returning the parent of the device if srcaddr is
none. The RSSI of the beacon request is then averaged into the value
for the device's parent.

Fix: Do not look up the neighbor if there is no source address in the
message, because there's no way to know who the message came from.
2022-10-21 13:27:52 -07:00
Yakun Xu ff259b845b [android] only set -std=c99 for mbedtls (#8310) 2022-10-21 13:02:18 -07:00
Tom Rebbert 488ee63b4c [coap] Bugfix: CoAP not sending 4.04 when URI handler is not found (#8297)
Update CoAP base handler to correctly detect when a handler is not
found and send a 4.04 response.

Prior to this change, the error code would be overridden in the case
where a URI handler was not found to kErrorNone. This meant that when
the exit code was reached, no 4.04 message was generated. This fixes
the logical flow to ensure the error message is sent on the link.
2022-10-20 19:24:05 -07:00
Jonathan Hui d8509e6254 [github-actions] update geekyeggo/delete-artifact to v2 (#8314) 2022-10-20 09:51:06 -07:00
Abtin Keshavarzian d805b5dd1c [routing-manager] add OnLinkPrefixManager (#8285)
This commit renames `LocalOnPreifx` class to `OnLinkPrefixManager` and
moves all the code related to managing of the on-link prefix to this
class, e.g., method `Evaluate()` to evaluate and make a decision
about on-link prefix (whether we need to advertise our local on-link
prefix or there is a favored discovered on-link prefix provided by
another router on infra link).
2022-10-19 15:49:59 -07:00
Jonathan Hui 3d5c4b41df [docs] fix build option table format (#8306) 2022-10-18 14:44:32 -07:00
Abtin Keshavarzian 68083d8a67 [srp-client] inform server on service remove even if not added yet (#8299)
This commit updates `Srp::Client` so that on `RemoveService()` we
always send an SRP Update message to server to remove the service even
if the service is not yet registered (from perspective of client).
2022-10-18 14:43:41 -07:00
Song GUO aae250af89 [nat64] add runtime switch for NAT64 prefix publisher and translator (#8194) 2022-10-18 14:42:25 -07:00
Simon Lin 77fd973a76 [multicast-forwarding] reduce warn logs (#8292) 2022-10-17 19:25:02 -07:00
Tom Rebbert 778fbfa82d [heap] move static heap construction to singleton accessor (#8242)
Move static heap construction to singleton accessor to avoid
non-trivial construction at global scope, which has an unpredictable
ordering.
2022-10-17 18:57:50 -07:00
parag-silabs c3bc9481e2 [cmake] disable OPENTHREAD_CONFIG_NCP_HDLC_ENABLE when OT_NCP_SPI is set (#8282) 2022-10-17 18:56:18 -07:00
Sarah 992f9c6374 [docs] Doxygen formatting updates (#8286)
For various reasons, we're not able to use `<` and `>` in our Doxygen
descriptions. I made some minor edits, LMKWYT. In the HTML, it renders
similar to this:

The IPv6 socket address string is formatted as [`address`]:`port`
where `address` is shown as 16 hex values separated by `:` and `port`
is the port number in decimal format, for example "[%x:%x:...:%x]:%u".
2022-10-17 11:09:10 -07:00
Sam Kumar d5333ca831 [cli-tcp] fix bug causing "accept" action for all incoming connections (#8291) 2022-10-17 09:10:47 -07:00
Sam Kumar 3d1bdf3317 [tcplp] fix bad memory access when refusing incoming TCP connection (#8291) 2022-10-17 09:10:47 -07:00
gavinmcgovern bdb9382976 [docs] resized Qorvo logo (#8279) 2022-10-14 11:07:41 -07:00
Jonathan Hui 05590e2dc8 [github-actions] migrate to actions/upload-artifact@v3 (#8278) 2022-10-14 08:47:48 -07:00
gavinmcgovern 9ebe41f16e [docs] who supports OT updates (#8263) 2022-10-13 11:38:44 -07:00
Abtin Keshavarzian f5e2a0f961 [routing-manager] adv local on-link prefix after added in net data (#8119)
This commit enhances `RoutingManager` so that when we decide to
advertise the local on-link prefix and publish it in Network Data as
an external route, we wait for it to be seen in the leader's Network
Data before including it in the emitted RA messages as PIO. If the
prefix is already present in Network Data (e.g., may have been added
by another BR on the same Thread mesh) we start advertising it
immediately. When publishing prefixes in Network Data, it may take a
short random time before the entry is registered with leader and the
updated Network Data is propagated to all Thread nodes. This change
delays the advertisement of the on-link prefix on the infra link side
till it is configured as an external route on the Thread side.
2022-10-13 09:15:17 -07:00
Jonathan Hui f92364c977 [dns-client] validate response timeout <= TimerMilli::kMaxDelay (#8275) 2022-10-13 08:37:22 -07:00
Abtin Keshavarzian f459d9e333 [core] remove OT_UNREACHABLE_CODE(break) (#8274)
This commit removes `OT_UNREACHABLE_CODE(break)` which is used
in `case` statements performing an `OT_ASSERT()` in a `switch` block.
If the `case` is the last one in the `switch` we can skip the `break`
and therefore we don't need to use `OT_UNREACHABLE_CODE()`.
2022-10-13 08:37:01 -07:00
Abtin Keshavarzian 16c927ea1c [routing-manager] enhance mechanism to publish/unpublish route prefixes (#8187)
This commit updates and enhances the mechanism in `RoutingManager`
to publish/unpublish external route prefixes in Thread Network Data.

Instead of each sub-component (e.g., `DiscoveredPrefixTable`,
`LocalOnLinkPrefix`, `Nat64PrefixManager`, ...) directly trying to
publish/unpublish its entries which can lead to conflicting requests
that then needs to be checked and handled by each component, this
commit adds a new method `EvaluatePublishingPrefix()`. This method
makes a collective decision by checking with different sub-components
to see whether or not each wants this prefix published and if so at
what preference level and flags.

This change help simplify the code and handling of conflicting
situations and edge cases (e.g., while deprecating current/old local
on-link prefix, other routers adding/removing same prefix as PIO or
RIO in their emitted RAs).
2022-10-12 15:13:16 -07:00
Sarah 23c01d7eaf [docs] CLI commands ifconfig - linkmetrics (#8253) 2022-10-12 14:34:45 -07:00
Abtin Keshavarzian 06bd4d6161 [link-metrics] update method finding neighbor to validate its version (#8271)
This commit renames and updates the `LinkMetrics::FindNeighbor()`
helper method which finds the neighbor for a given link-local address
for use in `LinkMetrics` class. This method now also validates that
the neighbor's Thread version is 1.2 or higher.
2022-10-12 14:17:24 -07:00
Yakun Xu 74cc79d7a2 [cmake-build] allow specify multiple targets (#8264)
This commit allows using OT_CMAKE_NINJA_TARGET to specify multiple
targets.
2022-10-12 13:09:04 -07:00
Jonathan Hui 3811b6529e [github-actions] migrate to actions/checkout@v3 (#8269) 2022-10-12 10:15:04 -07:00
Song GUO 43c66a3d5f [nat64] fix build issues related to NAT64 on POSIX (#8167)
The build might fail when using build systems other than cmake and
NAT64_TRANSLATOR is enabled.
- Reorder the functions in `src/posix/platform/netif.cpp`
- Define a default NAT64 CIDR
- Define `kNat64RoutePriority`
2022-10-11 22:47:50 -07:00
Abtin Keshavarzian 131e42c60f [cli] fix log filename command arg check (#8270) 2022-10-11 15:23:50 -07:00
Tom Rebbert 9c6b45c1dc [meshcop] support a zero-length network name for backwards compatibility (#8241)
Add a configuration option to support a zero-length network name
within the OT stack.
2022-10-11 15:22:57 -07:00
Abtin Keshavarzian 04feddc458 [netdata] update Publisher to reserve entries for RoutingManager (#8148)
This commit updates `NetworkData::Publisher` to reserve a set of
prefix entries for use by `RoutingManager` only. This allow us to
simplify how `RoutingManager` publishes route prefixes in Network
Data (assert on failure). In particular, this commit defines a new
enum `Requester` which specifies the requester (`kFromUser` or
`kFromRoutingManager`) associated with a published prefix. This is
used by methods `PublishExternalRoute()`/`PublishOnMeshPrefix()`.
When allocating new entries, we ensure that each requester is
limited to its maximum number of entries.
2022-10-11 12:57:33 -07:00
Abtin Keshavarzian ee83b1cb5d [backbone-router] simplify TMF URI resource handling (#8265)
This commit updates `BackboneTmfAgent` to handle TMF URI resources
(similar to the model used by `Tmf::Agent` added in #8233).
2022-10-11 09:11:20 -07:00
Jonathan Hui 76010bc9ad [docs] remove versioning note (#8266) 2022-10-11 08:31:43 -07:00
Eduardo Montoya f23eee42f8 [thci] fix setBbrDataset (#8261)
Cover the case when neither `MlrTimeout` or `ReRegDelay` are being
modified.
2022-10-11 08:31:08 -07:00
Abtin Keshavarzian 697c5e53a2 [border-agent] simplify ForwardToLeader() (#8260)
This commit updates `BorderAgent::ForwardToLeader()` to determine the
`petition` and `separate` boolean flags from the passed-in `aUri`.
2022-10-10 12:40:26 -07:00
Abtin Keshavarzian 13311256f6 [tmf] add SecureAgent and simplify URI resource processing (#8260)
This commit adds a new class `Tmf::SecureAgent` as a sub-class of
`Coap::CoapSecure`. It also simplifies the handling of TMF URI
resources by secure agent (similar model as in `Tmf::Agent` added
in #8233.
2022-10-10 12:40:26 -07:00
Jonathan Hui 09e06c6eff [dns-types] verify pointer refers to prior occurrence (#8262) 2022-10-10 11:45:39 -07:00
Abtin Keshavarzian e387505d4f [link-metrics] simplify handling of Type IDs (#8246)
This commit simplifies the handling of Type IDs in `LinkMetrics`
modules.
2022-10-10 10:54:19 -07:00
Abtin Keshavarzian 4a0d069ee8 [log] fix incorrect format strings (#8255) 2022-10-07 21:51:06 -07:00
Marek Porwisz b0266bc00e [ip6] fix packets not being forwarded outside of Thread (#8102)
Two changes made together broke fragmented packets handling: Some time
ago forwarding packets outside of thread was limited to 1280 bytes
Recently forwarding IP packet fragments was disabled.  This makes it
not forward packet fragments nor fully assembled packets.  According
to later change author this was to prevent packets from being handled
twice.

To fix this, forwarding of IP fragments was restored and instead
forwarding of reassembled frames was disabled regardless of the frame
size. This approach should save the need of fragmenting already
reassembled packets to fit into the
OPENTHREAD_CONFIG_IP6_MAX_DATAGRAM_LENGTH.

Signed-off-by: Marek Porwisz <marek.porwisz@nordicsemi.no>
2022-10-07 17:50:39 -07:00
Abtin Keshavarzian 2b726ef29f [border-agent] fix logging of RelayTx URI (#8254) 2022-10-07 14:02:51 -07:00
Abtin Keshavarzian 812c36f658 [tmf] new model for handling TMF URI resources (#8233)
This commit updates and simplifies the handling of TMF URI resources.
The new model centralizes the processing and dispatching of URI
handlers in `Tmf::Agent`. It should help reduce memory (RAM and
code) use as well.

- A new enumeration `Uri` type is defined specifying all the TMF
  URIs along with functions to map between `Uri` and the related
  URI path string.
- We use binary search in a sorted table to match a path string
  (e.g., from a received CoAP message) to its corresponding URI.
- `Coap` class is updated to allow sub-classes to register an
   optional `ResourceHandler` to handle URI resources.
- `Tmf::Agent` uses the new `ResourceHandler` to process the TMF URI
  resources and invoke the related handlers on the proper module
  (e.g., passing `kUriAddressQuery` to `AddressResolver` module,
  `kUriActiveSet` to `MeshCoP::ActiveDatasetManager`, etc).
- The TMF handlers are defined as `HandleTmf<Uri>()` template method
  specializations which are defined on the proper module.
- Most URI handlers can be processed at any time but some perform
  additional checks, e.g., `kUriAddressSolicit` is passed to
  `Mle::MleRouter` which checks that device role is leader before
  processing the request.
2022-10-06 18:32:22 -07:00
Abtin Keshavarzian c4b6206f16 [srp-client] new feature to allow lease and key lease per service (#8211)
This commit add a new feature in `Srp::Client` to allow user to
specify the lease and/or key lease intervals explicitly per service.
The lease intervals in a service can be left unspecified(set to zero)
in which case the default lease intervals will be used.

In an SRP Update message, the lease info is included in additional
section in an Update Lease Option record. Therefore the lease values
are applicable to the entire message and all its records. If we have
services with different lease intervals, they need to be registered
in separate messages. This commit updates `Srp::Client` to implement
such a mechanism. When preparing an SRP message, we first determine
the lease and key lease intervals and ensure the services using
matching intervals are included in the message.

This commit also updates and simplifies the "single service mode"
functionality to use the newly added mechanism for tracking which
services are included in the message.

This commit adds `test_srp_register_services_diff_lease` which covers
the behavior of the newly added mechanisms.
2022-10-06 18:31:25 -07:00
Eduardo Montoya a34d1176b9 [thci] remove unneeded problematic command (#8235)
Listing the table of rules results in SSH disconnection under some
circumstances. Removing the command since it doesn't add any
functionality.
2022-10-06 09:03:26 -07:00
Abtin Keshavarzian 4eb64510bf [test] update AdvanceTime() in unit tests to handle overflow (#8244) 2022-10-06 08:54:27 -07:00
Jonathan Hui 10de4c4f13 [fuzz] advance time before fuzz input enable to more services (#8243) 2022-10-06 08:54:00 -07:00
Abtin Keshavarzian 4f57b8d461 [meshcop] simplify energy scan client and server (#8230)
This commit updates `EnergyScanClient` and `EnergyScanServer`.
On server side, we prepare the report message after we parse the
request and directly append the results in the report message as
energy scans are performed. Client side is also updated to
correctly handle the case where the report message contains
greater number of results that can be supported on the client
based on its configuration.
2022-10-06 08:53:17 -07:00
Abtin Keshavarzian d3e00fbd28 [dns] allow partial read of TXT data and add config for max size in CLI (#8232)
This commit updates `Dns::Client` so that when reading service info
`otDnsServiceInfo` if the received TXT data does not fit in the given
buffer, it is read partially. A new field `mTxtDataTruncated` is added
in `otDnsServiceInfo` to indicate that TXT data was not fully read.

This commit also updates `dns` related commands in CLI so to output
the partially read TXT data and add a new config specifying the max
TXT data size used by CLI.
2022-10-05 15:10:28 -07:00
Jonathan Hui c5b4cd7bbc [doxygen] change inout to in,out (#8231) 2022-10-04 12:45:18 -07:00
Abtin Keshavarzian 61d9e72c18 [cli] update sub-modules to use Process<Cmd("cmd")> method (#8224)
This commit updates CLI `SrpServer`, `CoapSecure`, `UdpExample`, and
`TcpExample` to use the template `Process<Cmd("cmd")>` model. This
helps make them similar to other CLI modules.
2022-10-03 09:32:02 -07:00
Abtin Keshavarzian 7e8b482e3c [timer] add template TimerMilliIn to simplify handler functions (#8221)
This class adds a template sub-classes of `TimerMilli/Micro` which
allows us to directly specify an `Owner` for timer along with handler
callback as a member method of `Owner`. This helps simplify the
use of `Timer` in core module.
2022-09-30 11:32:56 -07:00
Jonathan Hui b3620ae51a [fuzz] add set -euxo pipefail to build script (#8222) 2022-09-30 11:24:20 -07:00
Suvesh Pratapa 6b712bd270 [cmake] allow configuring OPENTHREAD_CONFIG_MLE_MAX_CHILDREN with a CMake option (#8216)
This can help us configure this value during build time for OTBR
projects or other projects using CMake.
2022-09-30 09:50:12 -07:00
Abtin Keshavarzian bd8513b904 [ip6] define Ip6::NetifIdentifier mirroring otNetifIdentifier (#8219) 2022-09-30 08:36:48 -07:00
Song GUO 7954c34231 [nat64] support using IPv4 DNS server addresses in CLI (#8212)
Similar to TCP/UDP/PING commands, this command will print "Synthesized
IPv6 DNS server address:" when an IPv4 address is received.
2022-09-30 08:29:44 -07:00
Jonathan Hui f6df50cde6 [fuzz] declare otPlatLog as weak (#8220) 2022-09-29 20:59:32 -07:00
hemanth-silabs 081567fda6 [crypto] update the signature algorithm used for 3.2.0 mbedTLS (#8215)
`mbedtls_ssl_conf_sig_hashes` was deprecated in 3.2.0, and we
attempted to move over to the new recommended function. That new
function expects `MBEDTLS_TLS1_3_SIG_` type arguments.
2022-09-29 15:38:25 -07:00
Abtin Keshavarzian ba3d188db7 [srp-client] update "single service mode" to handle many removes (#8207)
This commit fixes the "single service mode" behavior to handle
if there are many simultaneous service removes. It also updates the
test to cover this situation.
2022-09-29 15:37:26 -07:00
Song GUO 06a6de24fa [nat64] add functional tests (#8161)
The test includes:
- Counters (protocol & error (4to6 no mapping, other errors are not
  expected))
- ICMP ping Connectivity
- UDP connectivity
2022-09-29 10:54:49 -07:00
Song GUO fc8949afb5 [nat64] fix typo: synthersize -> synthesize (#8213) 2022-09-29 10:51:06 -07:00
Tobías Lifschitz 12a1e618b2 [cli] print missing mac counters (#8210)
Co-authored-by: Tobias <tlifschitz@maper.com.ar>
2022-09-28 14:04:14 -07:00
Abtin Keshavarzian 32a17d8abe [test] update SRP unit test to prepare service entries in all cases (#8208) 2022-09-27 20:35:16 -07:00
Abtin Keshavarzian 02690328a8 [srp-server] lease info for a deleted service or host entry (#8206)
This commit updates the `Srp::Server` to allow lease info (in
particular the key-lease) to be retrieved for a deleted service or
host entry.
2022-09-27 09:43:20 -07:00
Abtin Keshavarzian 384dcbf631 [srp-server] update the default min/max lease/key-lease intervals (#8205)
This commit updates the default `LeaseConfig` intervals used by
`Srp::Server` to accept any requested lease time between 30 seconds
and 27 hours and any requested key lease time between 30 seconds and
189 hours.
2022-09-27 09:40:18 -07:00
Kangping ecdd5312a3 [posix] fix OT_DAEMON flag definitions (#8203)
We have to add the `OPENTHREAD_POSIX_CONFIG_DAEMON_ENABLE` definition
to `ot-config` because OpenThread core libraries will set config file
to "openthrad-core-posix-config.h" which depends on
`OPENTHREAD_POSIX_CONFIG_DAEMON_ENABLE` to correctly enable
PLATFORM_NETIF and PLATFORM_UDP features. Otherwise, OpenThread core
and posix libraries will use different feature definitions.
2022-09-27 08:58:23 -07:00
Jonathan Hui e64ba13faa [address-cache] increase default to 32 (#8204)
To reduce likelihood of cache miss and associated costs.
2022-09-26 12:58:52 -07:00
Jiachen Dong bcf9d8058e [harness-simulation] add the usage of the CLI command nodeidfilter (#8196) 2022-09-23 12:20:05 -07:00
Abtin Keshavarzian 5f7f48be9b [equatable] update Equatable to ensure CRTP-style use (#8199)
This commit updates `Equatable<Type>` to ensure CRTP-style use.
2022-09-23 09:05:32 -07:00
Abtin Keshavarzian 1942a79d75 [clearable] update Clearable to ensure CRTP-style use (#8198)
This commit updates `Clearable<Type>::Clear()` method to perform
`static_cast<Type *>(this)`. This ensures CRTP-style use and also
allows the `Clearable` to be used for types that may not be a
standard layout type (and/or more generally in cases where empty
base optimization may not be applied).
2022-09-23 09:04:24 -07:00
Abtin Keshavarzian 322671e682 [routing-manager] remove old deprecating prefix on multiple xpanid change (#8151)
This commit updates `RoutingManager` to ensure to unpublish the old
local on-link prefix being deprecated on ext PAN ID change if the ext
PAN ID happens to change again before the previous deprecating prefix
is expired. Note that the code supports retaining one old deprecating
prefix entry since back-to-back ext pan ID change is not expected as
a typical use-case. This commit also updates `test_routing_manager`
to cover and test this scenario.
2022-09-23 09:02:37 -07:00
Mason Tran cc8e4cce15 [cmake] add interface libraries ot-config-(ftd|mtd|radio) (#8190)
This allows for more granular control of any configuration which
might need to be incorporated in the core library build.
2022-09-22 23:20:35 -07:00
Abtin Keshavarzian da45d327c7 [routing-manager] allow old deprecating PIOs when checking RA is from router (#8193)
This commit updates `IsReceivedRouterAdvertFromManager()` which checks
if a received RA message was prepared by the `RoutingManager module
itself to allow deprecating PIOs in the RA message. These will handle
the case when old on-link prefix(es) (e.g., on extended PAN ID change)
are being deprecated.
2022-09-22 13:37:42 -07:00
Jiachen Dong fe655f4ef1 [thci] make OpenThreadTHCI compatible with Thread reference 20200818 (#8195) 2022-09-22 11:37:30 -07:00
Abtin Keshavarzian 8988bd84c3 [mle] add RouterTable::LogRouteTable() (#8189)
This commit updates the logging format of the route table. It adds
`LogRouteTable()` method in `RouterTable`.
2022-09-22 11:33:46 -07:00
Abtin Keshavarzian 13df0374d1 [routing-manager] fix prefix comparison in EvaluateOnLinkPrefix() (#8192)
This commit fixes `EvaluateOnLinkPrefix()` to use local on-link
prefix (instead of OMR prefix).
2022-09-21 14:11:22 -07:00
Mason Tran 32d7405174 [examples] make built-in otPlatCalloc and otPlatFree definitions weak (#8188)
This will allow platforms to define their own `otPlatCalloc` and
`otPlatFree` functions which may not map directly to `calloc()`
and `free()`
2022-09-21 11:11:37 -07:00
Abtin Keshavarzian 5a627ba0fd [test] add unit test test_srp_server (#8163)
This commit adds a unit test for `Srp::Server` (which also covers
`Srp::Client`) building a foundation for writing tests covering edge
cases of SRP server and its interaction with platform "update handler"
callback and SRP client.

For example, the test validates behavior of SRP sever, when
"update handler" accepts, rejects, or ignores (waits for timeout)
the received SRP updates. The test also validates that all heap
allocated objects (used by  SRP sever) are properly freed under
different scenarios (validating that there is no heap object leak).
2022-09-21 11:06:23 -07:00
Abtin Keshavarzian 615e951ca9 [srp-server] add AutoEnableMode to give control to BR (#8129)
This commit adds new APIs and mechanisms to support `AutoEnableMode`
in SRP server. This mode allows us to delegate the control of SRP
server (when it is enabled or disabled) to the Border Routing
Manager.

Under this mode, SRP sever is auto-enabled if/when `RoutingManager` is
done with the initial prefix and route setup, i.e., when the OMR and
on-link prefixes are determined, advertised in the emitted Router
Advert message on infrastructure side and published in the Thread
Network Data. This ensures that bi-directional connectivity is set up
before allowing service registration and discovery to start. The SRP
server is auto-disabled if/when BR is stopped, for example, when the
infrastructure network interface is brought down or when the BR gets
detached.

This commit also adds CLI commands for the new APIs and adds a
test-case in `test_routing_manager` to test and validate the newly
added mechanism.
2022-09-20 22:04:58 -07:00
Abtin Keshavarzian af1fd05f0b [gh-action] add new case to run unit test with toranj config (#8164)
This commit adds a new case under GitHub `toranj.yml` workflow to
build and run all unit test using the toranj OT configuration.
2022-09-20 18:21:13 -07:00
Abtin Keshavarzian 92f18c5c53 [cmake] add separate tcplp libraries for ftd and mtd (#8175)
This commit adds separate `tpclp-ftd` and `tcplp-mtd` libraries.
Each library is then `target_link_libraries()` with the related
`openthread-ftd/mtd`. This should help avoid situation where both
`openthread-ftd` and `openthread-mtd` are included as dependency
and linked and address linker failures under certain versions of
`clang`.
2022-09-20 15:43:19 -07:00
Abtin Keshavarzian bacf8d625f [routing-manager] add Nat64PrefixManager nested class. (#8178)
This commit adds `Nat64PrefixManager` class in `RoutingManager` which
contains the NAT64 related logic including generation of local NAT64
prefix, discovery of infra interface prefix, maintaining the
discovered prefix lifetime, and selection of the NAT64 prefix to
publish in Network Data. This class encapsulates all variables and
methods related to NAT64.
2022-09-19 11:01:44 -07:00
Jiachen Dong 6df8627135 [harness-simulation] update deviceInputFields.xml automatically (#8177)
This commit automatically updates the device fields in
deviceInputFields.xml, eliminating the need to update them manually.
2022-09-19 10:59:15 -07:00
Jiachen Dong 7b44e089a7 [harness-simulation] change config format from JSON to YAML (#8176)
This commit changes the format of the configuration file from JSON to
YAML, as YAML is designed for human interaction and better suitable
for configuration than JSON.
2022-09-19 10:58:08 -07:00
Sam Kumar 9d76424c3c [cli-tcp] use TCP Circular Send Buffer in TCP CLI tool and test (#7867) 2022-09-19 10:30:48 -07:00
Sam Kumar 19f9ba20a3 [tcp] implement TCP Circular Send Buffer (#7867) 2022-09-19 10:30:48 -07:00
Sam Kumar 5b430bf80b [tcp] suppress clang-tidy for re-declared TCPlp functions (#7867) 2022-09-19 10:30:48 -07:00
Jonathan Hui 2cab708443 [cc2538] move to openthread/ot-cc2538 (#8169) 2022-09-16 09:03:28 -07:00
Simon Lin 3a64f399bf [thci] wait for connection reset in powerDown (#8166)
This commit fixes `powerDown` to wait for connection reset after
issuing `reset` command.
2022-09-16 08:31:27 -07:00
Simon Lin 0756d1ea8f [dtls] fix DTLS connection issues (#8168)
This commit fixes two DTLS session issues on Posix:
- Fix the issue that UDP connect would cause the kernel socket to bind
  to an address that might be different from the address used by the
  Commissioner.
- Set the socket address to avoid kernel selecting an incorrect source
  address.
2022-09-15 20:55:01 -07:00
Jonathan Hui b5ea9c8106 [github-actions] use concurrency feature to cancel oustanding jobs (#8154) 2022-09-15 12:06:45 -07:00
Simon Lin b11121b7b5 [thci] fix mdns_query incorrect ip6tables rules (#8159)
This commit fixes the bug that `mdns_query` inserts `ip6tables` rules
in an incorrect order.  It also uses `ip6tables -F INPUT` to flush the
`INPUT` chain after mDNS query is done.
2022-09-15 08:52:41 -07:00
Song GUO 6973a1b067 [nat64] implement functions for NAT64 on the client side (#8126)
This commit adds the ability for accepting an IPv4 address for {ping,
tcp, udp} CLI commands.
2022-09-15 08:43:36 -07:00
Simon Lin a7e0516fb2 [thci] allow custom otbr-agent log dumping command via Param9 (#8137)
This commit allows THCI to use custom command to dump `otbr-agent`
logs via `Param9`.
2022-09-14 23:03:34 -07:00
canisLupus1313 bf2e1c39bc [cmake] add files allowing direct integration to Zephyr's west (#8143)
This commit adds CmakeLists and west config in order to be able to
directly integrate the openthread with zephyr build system.
2022-09-14 22:50:04 -07:00
Jiachen Dong a0c4ede86d [harness-simulation] add support for RF enclosure simulation (#8092)
This commit adds support for RF enclosure simulation. It can pass
Leader 9.2.9, Router 9.2.9 and Router 9.2.10 in Thread Test Harness
v56.0 now.
2022-09-14 14:31:06 -07:00
Eduardo Montoya 436bde84f5 [cli] document the ping async option (#8158) 2022-09-14 11:40:57 -07:00
Jonathan Hui 1fad9f7626 [github-actions] use external repo for arm build check (#8153)
Also remove autotools build checks.
2022-09-14 11:39:28 -07:00
Song GUO b66d521d1d [nat64] implement CLI functions for NAT64 (#8058)
This commit introduces `nat64` command and 4 new subcommands
(`configuredcidr`, `configuredprefix`, `mappings`, `counters`)

nat64 cidr -- Get the configured CIDR for NAT64 translator.
nat64 mappings -- Get the mappings of NAT64 translator.
nat64 counters -- Get the packet counters and error counters of NAT64
                  translator.

This commit also introduces related API for the above commands, and
`otIp4AddressToString` & `otIp4CidrToString` for the CLI to format the
IPv4 address and CIDR.
2022-09-13 09:39:50 -07:00
Abtin Keshavarzian 531339b65d [link-metrics] simplify preparation of MLE Data Request (#8142)
This commit simplifies the preparation of MLE Data Request message
which include a Link Metrics Query TLV and its sub-TLVs.
2022-09-13 08:44:45 -07:00
Sam Kumar dd02babfeb [tcplp] add test for contiguify functionality (#7868) 2022-09-12 21:54:33 -07:00
Abtin Keshavarzian f4c76f11fc [config] include misc.h in srp_client.h (#8146)
This ensures that `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is
defined in `config/srp_client.h` and can be safely used for defining
`OPENTHREAD_CONFIG_SRP_CLIENT_BUFFERS_MAX_HOST_ADDRESSES`.
2022-09-12 21:28:35 -07:00
Jonathan Hui e9877198c4 [fuzz] enable SRP server in fuzz targets (#8145) 2022-09-12 21:23:31 -07:00
Jonathan Hui 945edf1eb6 [fuzz] bump Thread version to 1.3 (#8145) 2022-09-12 21:23:31 -07:00
Abtin Keshavarzian 2ad5515be2 [routing-manager] deprecate previous local on-link prefix on xpanid change (#8112)
This commit updates `RoutingManager` to deprecate a previously
advertised local on-link prefix when extended PAN ID gets changed.
The local on-link prefix is derived from Thread network extended PAN
ID.  On extended PAN ID change, we continue to include the the old
prefix (if it was being advertised) in the emitted RAs as PIO (with
zero preferred lifetime) and continue to publish it in Network Data
up to its lifetime. This ensures that any device on infrastructure
link side that may be using an IPv6 address based on this old prefix
can continue to communicate with the Thread mesh devices.

This commit also adds a test-case in `test_routing_manager` to
validate the behavior of the newly added mechanism when ext PAN ID
changes while the local on-link is being advertised and also while
it was being deprecated.
2022-09-12 21:23:03 -07:00
Abtin Keshavarzian 1861291a62 [routing-manager] add RsSender nested class (#8124)
This commit adds `RsSender` class in `RoutingManager` which contains
the logic related to the transmission of Router Solicitation
(RS) messages to discover other routers. This class encapsulates all
variables, constants, and methods related to the RS transmission
mechanism(number of RS messages in a cycle, time intervals, etc).
2022-09-12 13:00:48 -07:00
Eduardo Montoya 865727adc8 [tcp] extend test to cover otTcpStopListening API (#8133)
Make sure `otTcpStopListening` is verified.
2022-09-09 20:20:28 -07:00
Jiachen Dong 4311d1931a [harness-simulation] add multiple-version support (#8075)
This commit adds multiple-version support, and uses a unified
configuration file to specify all the parameters.
2022-09-09 13:32:17 -07:00
Abtin Keshavarzian 2a27a15c1a [srp-server] log the content of processed SRP update message (#8131)
This commit updates the `Srp::Server` to log the processed info in a
received SRP Update message, such as host name, lease times, host
addresses, all services (and sub-types) being added or removed. The
info is logged before invoking the "update handler" and/or committing
the info into existing data. This change can help with debugging
issues.
2022-09-09 08:42:47 -07:00
Abtin Keshavarzian ccf8ea6923 [srp-client] update document about selected preferred server (#8125)
This commit updates `otSrpClientEnableAutoStartMode` documentation
to describe how the preferred server is determined from Network Data
entries (different Network Data entry categories, their order of
preference, and how to handle when there are multiple options within
the same category).
2022-09-06 15:27:22 -07:00
Jonathan Hui 1929c7c187 [github-actions] add gcc-12 to build matrix (#8118) 2022-09-06 11:19:09 -07:00
Jonathan Hui f88f954289 [ncp] fix init order to resolve compiler warning (#8118) 2022-09-06 11:19:09 -07:00
Jonathan Hui ae4c28c5ae [core] do not use FreeMessageOnError() on nonnull pointer (#8118) 2022-09-06 11:19:09 -07:00
Abtin Keshavarzian a53715b231 [link-metrics] simplify processing of SeriesFlags (#8116)
This commit updates `SeriesFlags` definition to map to the public
`otLinkMetricsSeriesFlags` struct and adds helper methods to convert
to or set it from a `uint8_t` flags bitmask which is read or written
in the TLVs.
2022-09-06 08:50:17 -07:00
Abtin Keshavarzian f43b9f0332 [routing-manager] add ScheduleRoutingPolicyEvaluation() (#8115)
This commit adds a new method `ScheduleRoutingPolicyEvaluation()` in
`RoutingManager` which combines the logic from different related
methods. This helps simplify the code. The new method accept an enum
`SchduleMode` input which indicates the rule to use when determining
the next policy evaluation time, e.g., schedule it immediately, or
after a random delay, or after short random jitter time to reply to
a received RS, etc.
2022-09-06 08:49:27 -07:00
Abtin Keshavarzian 46c7dccfef [discover-scanner] invoke handler when scan is done from a tasklet (#8111)
This commit updates `DiscoverScanner` so when scan operation is
finished it uses a `Tasklet` to clear the state and invoke the
callback. This allows users to safely call OT APIs from the
callback.
2022-09-06 08:46:27 -07:00
Abtin Keshavarzian 5d50088da9 [routing-manager] rename published NAT64 prefix (#8113)
This commit renames the variable representing the NAT64 prefix
which is published in Network Data to `mPublishedNat64Prefix`.
2022-09-01 11:01:53 -07:00
Abtin Keshavarzian 6dca78e757 [link-metrics] add blocking CLI query command and enhance tests (#8108)
This commit updates CLI `linkmetrics query` command to allow it
to be used in blocking mode (wait for response to query). This
is then used in different tests to validate the `LinkMetrics`
module behavior. In particular, `v1_2_test_single_probe` and
`v1_2_LowPower_7_2_01_ForwardTrackingSeries` are updated to
validate that the received query report message is correctly
parsed.
2022-09-01 10:49:02 -07:00
Abtin Keshavarzian c3dd3ba8fb [mle] update DetachGracefully() to stop BR routing manager (#8105)
This commit updates `Mle::DetachGracefully()` to stop Border Router
`RoutingManager`. This ensures that BR will have the chance to send
a final Router Advertisement message desecrating/removing its
previously advertised on-link or route prefixes.
2022-09-01 08:19:57 -07:00
Simon Lin 30d65bca48 [thread-cert] import Crypto on demand (#8109)
This commit imports `Crypto` module only when it's used.

This helps thread-cert tests that do not use message factory to run
without having to install `Crypto` module.
2022-08-31 19:48:24 -07:00
Song GUO bce7c1ae1f [nat64] change BORDER_ROUTING_NAT64 to NAT64_BORDER_ROUTING (#8047)
We decided to rename BORDER_ROUTING_NAT64 to NAT64_BORDER_ROUTING so
the flag won't be confusing since we have NAT64_TRANSLATOR which does
not depends on the border routing manager.
2022-08-30 21:05:28 -07:00
rxwen 3d60038bcb [posix] make base class destructor virtual (#7220) 2022-08-30 11:04:21 -07:00
Abtin Keshavarzian d9fd256b47 [tlvs] rename method to ReadTlvValue() from ReadTlv() (#8100)
This commit renames the method from `ReadTlv()` to `ReadTlvValue()`
to emphasize that it read the TLV value only (unlike `FindTlv()` helper
methods which find and read the whole TLV).
2022-08-30 09:11:06 -07:00
Abtin Keshavarzian ba4389a44a [radio] define Radio::kInvalidRssi constant (#8097)
This commit harmonizes the constant used to indicate an "Invalid RSSI
value". It defines `Radio::kInvalidRssi` which is then used in all
core modules replacing `OT_RADIO_INVALID_RSSI` and similar constants
in `SubMac/Mac`.
2022-08-30 09:10:18 -07:00
Abtin Keshavarzian a6032491b8 [link-metrics] fix reading of Report sub-tlv from message (#8099) 2022-08-29 20:25:34 -07:00
Jonathan Hui 0988f460dc [github-actions] migrate to ubuntu 20.04 to 18.04 (#8061) 2022-08-29 10:51:35 -07:00
whd 9308db14c9 [otci] support ADB connection for OTCI (#8088) 2022-08-25 23:19:28 -07:00
Abtin Keshavarzian ba006225e0 [link-quality] helper fn to convert link margin, link quality, RSS (#8081)
This commit simplifies the helper functions that convert between
link margin, link quality and RSS (replacing the `static` methods
in `LinkQualityInfo`).
2022-08-25 14:10:29 -07:00
Abtin Keshavarzian 10c9a365f2 [link-metrics] simplify sending MLE Mgmt Request (#8073)
This commit adds `FwdProbingRegSubTlv` which is used to simplify
`SendMgmtRequestForwardTrackingSeries()` implementation. Similarly
`EnhAckConfigSubTlv` is updated and used to simplify method
`SendMgmtRequestEnhAckProbing()`.
2022-08-25 11:17:56 -07:00
Sarah cd83fc1477 [docs] CLI Dataset (#7944) 2022-08-25 11:15:37 -07:00
Abtin Keshavarzian 958eb5c5bf [srp-server] update validation of instance and service names (#8080)
This commit updates `ProcessServiceDiscoveryInstructions()` method
to use `Dns::Name::IsSubDomainOf()` to validate the relation between
service instance name and the base service name.
2022-08-25 11:11:35 -07:00
Abtin Keshavarzian d72c10eed3 [routing-manager] advert local on-link prefix if same as discovered prefix (#8079)
This commit updates the `RoutingManager` such that if we see that that
current favored discovered on-link prefix (from processed RAs from
other router) matches our local on-link prefix, we start/continue
advertising it as well. The local on-link prefix is derived from
extended PAN ID and therefore is the same for all BRs on the same
Thread mesh. Having multiple BRs advertise the same on-link prefix
adds redundancy (in case one BR goes offline).
2022-08-25 11:09:42 -07:00
Abtin Keshavarzian 989a56e96d [link-metrics] update the scaling of link margin and RSSI metrics (#8078)
This commit updates the scaling of the link margin and RSSI metrics.
The metric values are scaled when appended in the message (in a
Report sub-TLV) or when they are read back from received message. The
stored value in `MetricsValues` are changed to be always the actual
metric value (not the scaled value). This ensures that the value are
stored in proper int type (e.g., RSSI is `int8` vs the scaled value
which is `[0,255]`). Methods are added to perform the scaling which
now rounds to closest integer ensuring the reverse scaling gives back
the original value. Unit test is added to validate the scaling
methods.
2022-08-25 11:08:44 -07:00
Abtin Keshavarzian cba1bebf1f [child-table] check neighbor is in ChildTable before cast as Child (#8071)
This commit adds a check `Get<ChildTable>().Contains(Neighbor &)`
to ensure that the neighbor is from the child table before casting
the neighbor entry to `Child`. This adds safety and protection against
potential corner-case where we have a neighbor entry which is
`Parent` or `ParentCandidate` that is a REED.
2022-08-24 23:35:21 -07:00
Jonathan Hui d7cbc17961 [posix] initialize hints in InfraNetif::DiscoverNat64Prefix (#8070) 2022-08-24 22:15:07 -07:00
Jiachen Dong 0f10480ed6 [harness-simulation] fix build_docker_image.sh error (#8072) 2022-08-24 10:53:11 -07:00
Abtin Keshavarzian e51941177f [mle] add ParentCandidate class (#8069)
This commit adds `ParentCandidate` in `Mle` class (as a sub-class of
`Parent`) and moves all member properties related to parent candidate
to this new class.
2022-08-24 10:46:14 -07:00
Abtin Keshavarzian 9699d319af [takelet] add template TaskeltIn to simplify handler functions (#8064)
This class adds a template sub-class of `Tasklet` which allows
us to directly specify an `Owner` of tasklet along with handler
callback as a member method of `Owner`. This helps simplify the
use of `Tasklet` in core module.
2022-08-24 10:44:48 -07:00
Sarah 5516024905 [docs] CLI child commands (#8041) 2022-08-23 17:33:14 -07:00
Eduardo Montoya 130cfd790c [thci] remove unused methods (#7704)
`setActiveDataset` and `setCommisionerMode` have been removed from
the `iThci` abstract class in the latest harness release.
2022-08-23 16:30:10 -07:00
Abtin Keshavarzian d17bde5b2d [mle] move simple RLOC to Router ID conversion functions to mle_types.hpp (#8060)
This commit moves simple `static` member methods from `Mle` class to
`mle_types.hpp` (under `Mle` namespace).
2022-08-23 16:14:09 -07:00
Abtin Keshavarzian 2c3a10d67a [mac] add ComputeLinkMargin() (#8063)
This commit adds a helper method in `Mac` to compute link margin
from a given received signal strength (in dBm) using the radio
noise floor.
2022-08-23 14:37:21 -07:00
Abtin Keshavarzian 9d70832b85 [link-metrics] simplify HandleReport() (#8054)
This commit updates `LinkMetrics::HandleReport()` method:
- Fixes issue where `Status` sub-TLV would not be read.
- Uses `Tlv` helper method to read the sub-TLVs.
- Reads `ReportSubTlv` directly from message and uses its methods
  to get the metrics values.
- Fixes issue where we would not skip over unknown sub-TLVs
  correctly.
2022-08-23 14:34:09 -07:00
Yi 3d146f3f60 [nat64] disable discovering NAT64 AIL prefix for OpenWRT (#8065) 2022-08-23 08:32:56 -07:00
canisLupus1313 85fb24aedf [mesh-forwarder] fix random ieee frame version 2015 while attaching (#8067)
This commit fixes random 2015 frame version issue while attaching to
REED. the problem was caused by unconditionally casting Router structure
to Child structure and making out of original structure memory access.

Signed-off-by: Przemyslaw Bida <przemyslaw.bida@nordicsemi.no>
2022-08-23 07:05:04 -07:00
Jiachen Dong 0b8e9745e5 [thci] add support for OTBR simulations (#8015)
It can run all Thread 1.2 test cases with simulations now except those
requiring multiple versions support. It has been tested with the DUT
being a role of Router, Leader, Border Router, BR_1 and BR_2.
2022-08-22 21:32:45 -07:00
Abtin Keshavarzian 142b8cf58c [core] add generic three-way comparison function (#8050)
This commit adds a generic `ThreeWayCompare()` function. It also
renames header to `num_utils.hpp` from `min_max.hpp`.
2022-08-22 19:52:02 -07:00
Abtin Keshavarzian 188ec0d476 [link-metrics] define StatusSubTlv to simplify appending/parsing it (#8051)
Status sub-TLV has a single `uint8_t` status value so we can use
declare it as `UintTlvInfo<SubTlv::kStatus, uint8_t>` and then use
helper `Append<StatusSubTlv>` and `Read<StatusSubTlv>` to append
and read it.
2022-08-22 19:26:25 -07:00
Abtin Keshavarzian 570e30522f [address-resolver] simplify EntryInfo and Iterator (#8055) 2022-08-22 17:47:07 -07:00
whd 8942e7f895 [multicast-routing] block egress multicast packets from LLA (#8059)
According to the Spec, egress packets from LLA should not be
forwarded. Linux kernel doesn't automatically block such forwarding
so that we need to check this before adding the MFC entry.
2022-08-22 16:34:52 -07:00
Jonathan Hui 370d4dc0b5 [docs] update Thread version (#8053) 2022-08-22 16:30:36 -07:00
Abtin Keshavarzian b8b88d9492 [mle] track LeaderCost in Parent class (#8052) 2022-08-22 16:30:17 -07:00
Abtin Keshavarzian 96bba3659c [topology] add Router::GetTwoWayLinkQuality() method (#8049)
This commits add `GetTwoWayLinkQuality()` method to `Router` class
which returns the minimum of router's Link Quality In and Out
values. It also adds `GetLinkQualityIn()` to `Neighbor`. These
are used in `Mle` and `MeshForwarder`.
2022-08-22 16:22:31 -07:00
Abtin Keshavarzian fdd0afacc5 [link-metrics] simplify AddReport() (#8042)
This commit simplifies the `LinkMetrics::AddReport()` method so that
when preparing the MLE Link Metrics Report TLV (and its sub-TLVs) we
determine the TLV length after all sub-TLVs are appended to the
message from the number of written bytes in the message (difference
between `aMessage.GetLength()` and initial offset of the TLV). This
allows to simplify methods `AppendReportSubTlvToMessage()` and
`AppendStatusSubTlvToMessage()` as well.
2022-08-22 16:19:18 -07:00
Yi e50be395e4 [nat64] extend wait time between test cases and verify netdata stabilized (#8057)
This commit extend the wait time after disabling border routing and a
new case is added to verify that the netdata is stable again.
2022-08-22 16:14:07 -07:00
Kangping d48799dddf [border-agent] update logging for filtered messages (#8045)
Update border agent logging for filtered messages to debug level to
avoid confusion, because it's actually not a error case.
2022-08-20 08:05:59 -07:00
Abtin Keshavarzian a5eb1c9401 [link-metrics] add link_metrics_types.hpp (#8040)
This commit adds a new header files `link_metrics_types.hpp` which
includes all `LinkMetrics` related types and constants. The related
type definition are moved to this header from `link_metrics.hpp` and
`link_metrics_tlvs.hpp` (which now contains the TLV definitions only).

This commit also moves the more complex method implementations to the
`cpp` file.
2022-08-19 11:13:15 -07:00
Sam Kumar 829632e33e [tcp] implement otTcpReceiveContiguify (#7634) 2022-08-19 10:12:40 -07:00
Sam Kumar 0126c5f44b [tcp] modify cbuf to be able to use all bytes provided by the user (#7634) 2022-08-19 10:12:40 -07:00
Abtin Keshavarzian a0718d90b1 [mle] define DetachGraecfuly variables as private (#8044)
This commit changes the definitions (member variables, constants, and
methods) related to graceful detach mechanism to be `private` instead
of `protected` since they are only accessed/used by the `Mle` and not
by its sub-class `MleRouter`.
2022-08-18 23:01:26 -07:00
Abtin Keshavarzian 4dd9fd0c9e [link-metrics] fix integer conversions & use of u8 for offset (#8043)
This commit addresses integer conversion warnings in `LinkMetrics`.
In particular it updates `ReadTypeIdFlagsFromMessage()` to use
`uint16_t` as offset value (instead of `uint8_t`).
2022-08-18 23:00:51 -07:00
Abtin Keshavarzian 969d511d04 [routing-manager] allow domain prefix to be considered as OMR (#8014)
This commit updates the `RoutingManager` to allow domain prefix from
Network Data to also be considered during OMR selection. In
particular:
- `IsValidOmrPrefix(config)` now accepts prefixes with `mDp` flag.
- `OmrPrefix` now tracks whether the prefix is domain prefix.
- When appending RIO in RA message, the domain prefix is always
  excluded (independent of whether or not it is the current favored
  OMR prefix).

This commit also updates the `test_routing_manager` unit test to add
a test case checking behavior of `RoutingManager` when a domain prefix
is selected as the favored OMR.
2022-08-18 22:41:49 -07:00
Abtin Keshavarzian c2b6621d9f [ip6] add MessageOrigin to indicate origin or IPv6 message (#8036)
This commit adds a new enum `Ip6::MessageOrigin` which indicates the
origin of the message: From Thread Netif or from host. In case the
message is originating from host, it also indicates whether or not it
is allowed to pass back the message to the host.
2022-08-18 22:32:10 -07:00
Song GUO e84f05c641 [nat64] implement nat64 translator (ot::Nat64::Translator) (#7836)
This commit:

- implements the core logic for translating packets for NAT64,
  including the public APIs exposed to platform daemons.

- includes changes for POSIX platform, use `OT_POSIX_NAT64_CIDR`,
  `OPENTHREAD_POSIX_CONFIG_NAT64_CIDR` for setting the CIDR for NAT64
  during build time.

- exposes `otNat64Send(otInstance *aInstance, otMessage *aMessage)`
  and `void otNat64SetReceiveIp4Callback(otInstance *aInstance,
  otNat64ReceiveIp4Callback aCallback, void *aContext)`.
2022-08-18 22:28:26 -07:00
whd 20aee3fa70 [multicast-routing] don't add MFC entries using mesh local as the source address (#8025)
According to Thread Spec, PBBR should not forward a multicast packet
from Thread interface to Backbone interface when the source address is
Mesh-Local.
2022-08-17 22:59:50 -07:00
Abtin Keshavarzian 897a29565e [api] harmonize nullptr assert check of pointer input parameters (#8031)
This commit harmonizes and simplifies the code related to asserting
that the OT API pointer parameters are valid and not `nullptr`.
`OPENTHREAD_CONFIG_ASSERT_CHECK_API_POINTER_PARAM_FOR_NULL` is added
which when used performs assert check on all pointer inputs to APIs.
This is either done within `AsCoreType()` when the pointer is
converted to its related core type, or by a direct call to newly added
macro `AssertPointerIsNotNull()`.

Since enabling assert checks on every API parameter can increase code
size, this config is disabled by default and it is recommended to use
it during debugging only.
2022-08-17 20:22:19 -07:00
Abtin Keshavarzian cb91e43322 [mle] add Parent class (tracking CSL accuracy info) (#8029)
This commit adds `Parent` class as a sub-class of `Router` and moves
the CSL accuracy definitions in `Parent` class (from `Router`) since
we need to track CSL info only for the parent and not other entries
in the router table. This helps reduce the memory/RAM used by router
table.
2022-08-17 19:21:19 -07:00
Abtin Keshavarzian 1d10948069 [router-table] simplify Allocate() and random selection of ID (#8032)
This commit updates `RouterTable::Allocate()` to use Reservoir
sampling algorithm to randomly select a router ID while iterating
through the list of available IDs.
2022-08-17 15:36:10 -07:00
Abtin Keshavarzian 061d22ba8e [ip6] simplify Ip6::HandleDatagram() - remove netif local var (#8035)
This commit updates `Ip6::HandleDatagram()` and removes the local
`netif` variable and directly uses `ThreadNetif` instead. Note that
the input parameter `aNetif` is either `nullptr` or points to
`ThreadNetif`, and in both cases the local variable `netif` will be
set to point to `ThreadNetif`.
2022-08-17 14:32:18 -07:00
Abtin Keshavarzian 2d4896f675 [ip6] remove extra param from Ip6::HandleExtensionHeaders() (#8035)
This commit updates `Ip6::HandleExtensionHeaders()` removing
`aIsOutbound` input and instead using `(aNetif == nullptr)` to
determine this.
2022-08-17 14:32:18 -07:00
Abtin Keshavarzian 7f73cd42a4 [link-metrics] fix the endian-ness of mPduCountValue (#8039)
This commit updates `LinkMetrics::AppendReport()` to ensure
the `values.mPduCountValue` (which is a `uint32_t`) is stored in
the host MCU encoding and not in big-endian encoding.

This was originally added in #7046 as a fix (basically saving the
value in local variable in the encoding we expect to later include
in the Report TLV), however #8006 updates the `ReportSubTlv` methods
to do the encoding change in the `Get/SetMetricsValue32()` (similar
to other OT `Tlv` definitions).
2022-08-17 12:00:27 -07:00
Abtin Keshavarzian 1b5298eb76 [csl] add CslAccuracy type (#8024)
The CSL accuracy is represented as two parameters: clock accuracy in
ppm, and uncertainty in units of 10 microseconds. These two parameters
are often used together. This commit adds a new class `CslAccuracy`
encapsulating both. This new type is used in `Mac` and `Mle` methods
allowing us to pass both in one object.

This commit also adds `Mle::RxMessage::ReadCslClockAccuracyTlv()` to
read and parse the CSL Accuracy TLV value from a given received MLE
message.
2022-08-16 22:19:14 -07:00
Simon Lin f790edd5e2 [github-actions] upgrade pyshark to 0.4.6 (#8030) 2022-08-16 16:23:43 -07:00
Abtin Keshavarzian 8161a90a0c [thread] add version consts & use uint16_t for Neighbor::mVersion (#8027)
This commit adds `thread/version.hpp` which defile Thread Version
constants. It also changes the `mVersion` in `Neighbor` class to
use `uint16_t` to track the version. This help harmonize it with
the MLE Version TLV and and version in `Settings`. Due to memory
alignment of existing member variables the change (from `u8` to
`u16`) does not increase the memory requirement for child or router
table.
2022-08-16 16:22:35 -07:00
Abtin Keshavarzian bbac0e7980 [ip6] update HandlePayload() (avoid msg clone if not needed) (#8023)
This commit adds a smaller enhancement in `Ip6::HandlePayload()`. If
support for TCP `OPENTHREAD_CONFIG_TCP_ENABLE` is not enabled, we
exit early from this method before potentially creating a clone of
the message (to free later).
2022-08-16 15:55:48 -07:00
Abtin Keshavarzian 47e5277659 [mle] define ParentSearch class (#8022)
This commit adds `Mle::ParentSearch` class which encapsulates all
definitions (variables, constants, and methods) related to "Parent
Search" feature.
2022-08-16 15:55:09 -07:00
Jonathan Hui 4c8ae758fd [routing-manager] fix call to StartRoutingPolicyEvaluationJitter() (#8034) 2022-08-16 15:54:23 -07:00
Abtin Keshavarzian 51c58d9080 [slaac] only allow SLAAC for prefixes with 64-bit length (#8021)
This commit updates `Slaac` module to only allow prefixes with
64-bit length.
2022-08-16 13:21:51 -07:00
Zhangwx 7c648559da [bbr] reduce the default reregisteration delay (#7996)
After BBR restarting, in order to receive the packets from multicast
group, the devices, which have registered multicast group addresses to
that BBR, needs to re-register these groups. In current logic, the
default max reregistration delay is too large (1200 seconds).
2022-08-16 13:20:47 -07:00
Simon Lin 92a5bd5451 [routing-manager] increase routing policy evaluation jitters (#7982)
This commit increase the routing policy evaluation jitter from 1
second to 2~4 seconds to avoid adding on-link prefix when the AIL GUA
prefix is unavailable for a very short duration (usually during GUA
prefix renewing).
2022-08-16 13:19:34 -07:00
Simon Lin 1bc309452f [thci] send mdns queries without dig (#7954)
Some mDNS implementations do not respond to mDNS queries sent by
`dig`.
2022-08-16 13:18:55 -07:00
Eduardo Montoya 01dd49286e [doc] fix RCP building information for nRF52840 (#8020) 2022-08-12 16:07:08 -07:00
Abtin Keshavarzian f33a586530 [mle] new API to trigger search for better parent (#8018)
This commit adds `otThreadSearchForBetterParent()` to start the
process on a child to search for a better parent while staying
attached to its current parent. This commit also adds a related CLI
command `parent search`.
2022-08-12 16:05:53 -07:00
Abtin Keshavarzian d1d8c6fecd [mle] add method to get parent info (#8019)
This commit moves the code for getting the parent info from the
`thread_api.cpp` to `Mle` class `GetParentInfo()` method. It also
updates the `Router::Info::SetFrom()` to populate the `mVersion` and
the newly added CSL related fields. This allows us to re-use the
same code for both router or parent info.
2022-08-12 11:26:47 -07:00
Abtin Keshavarzian 3aa4060018 [routing-manager] accept any ULA/GUA with 64-bit len as OMR prefix (#8016)
This commit updates `IsValidOmrPrefix()` to accept any ULA/GUA
prefix with 64-bit length as OMR prefix.
2022-08-12 11:23:38 -07:00
Abtin Keshavarzian d06f96a50f [routing-manager] add RaInfo tracking all RA related info (#8013)
This commit adds a new struct `RaInfo` in `RoutingManager` which
tracks info about emitted RA messages: Number of RAs sent, last tx
time, header to use and whether the header is discovered from
receiving RAs from the host itself. This helps encapsulate all
related info in one data structure.
2022-08-12 11:22:46 -07:00
Abtin Keshavarzian fda4549df7 [core] add new generic Min(), Max() and Clamp() functions (#8017)
This commit adds generic helper functions:

- `Min()` to get the minimum of two values,
- `Max()` to get the maximum of two values, and
- `Clamp()` to clamp a value to a given closed range from a minimum
   up to a maximum value. It also adds functions
- `ClampToUint8()` and `ClampToUint16()` to clamp a `uint` value to
   a smaller bit-size (`uint8_t` or `uint16_t`) range.
2022-08-12 09:22:18 -07:00
Laukik Hase 82088fe24d [meshcop] update deprecated functions for Mbed TLS v3.2.1 (#7977)
- Updated the following deprecated APIs with their respective alternatives
  - `mbedtls_ssl_conf_min_version` => `mbedtls_ssl_conf_min_tls_version`
  - `mbedtls_ssl_conf_max_version` => `mbedtls_ssl_conf_min_tls_version`
  - `mbedtls_ssl_conf_sig_hashes` => `mbedtls_ssl_conf_sig_algs`
- Updated the parameter data-type for `mbedtls_ssl_conf_sig_algs`
  (list of allowed signature algorithms) from `int` to `uint16_t`
- Added macros for backward compatibility
2022-08-12 09:15:04 -07:00
Yi 80565c58a9 [nat64] fetch NAT64 prefix from infrastructure interface and advertise it to netdata (#7619)
This commit fetches the NAT64 prefix on infrastructure interface and
advertise it to Network Data at medium preference.

- Use `getaddrinfo_a()` function to asynchronously lookup the ipv6
  address of the special domain `ipv4only.arpa`. The infrastructure
  NAT64 prefix is extracted from the domain answer.

- `mInfraIfNat64PrefixStaleTimer` is scheduled to monitor the presence
  and change of infrastructure NAT64 prefix.

- `EvaluateNat64Prefix` evaluates whether to advertise the
  infrastructure prefix or the local ULA prefix or neither. When there
  is a new infrastructure prefix, it will withdraw the legacy one and
  add the new one. When the infrastructure prefix no longer exists, it
  will withdraw the legacy one and add the local ULA prefix. When the
  infrastructure prefix presents again, it will add the infrastructure
  prefix and withdraw the local ULA prefix.

New tests are added to test the scenarios when infrastructure NAT64
prefix exists.  `DNS64` on OTBR is turned on to enable `bind9` with
NAT64 prefix on infrastructure interface for these tests. `bind9` is
explicitly turned off when testing local ULA prefix.  Since bind9 is
conflict with other components like dnssd, all nat64 tests are moved
under /nat64 directory and configured separately.

The case that two or more BRs have same infrastructure NAT64 prefix is
not covered by this commit and will be followed up later.
2022-08-12 07:37:05 -07:00
Abtin Keshavarzian 034fc826f3 [routing-manager] use Ip6::Prefix::IsUniqeLocal() to check OMR prefix (#8012)
This commit updates `IsValidOmrPrefix()` to use `IsUniqeLocal()`
method of `Ip6::Prefix`. This relaxes the check to allow any ULA
prefix and not necessarily with 64 bits prefix length.
2022-08-11 11:16:46 -07:00
Abtin Keshavarzian a1e2698401 [ip6-address] move more complex Prefix methods to cpp file (#8011)
This commit moves more complex methods of `Ip6::Prefix` class to the
`cpp` file. It also simplifies the `IsLinkLocal()` implementation. It
also updates unit test `test_ip_address` to validate `IsLinkLocal()`,
`IsMulticast()`, and `IsUniqueLocal()` methods.
2022-08-11 11:15:11 -07:00
Abtin Keshavarzian ea1b2292be [mle] add TlvList to track list of TLV types (#8008)
This commit adds `Mle::TlvList` type which represents a list of MLE
TLV types. It provides helper methods to `Add()` TLVs to the list
ensuring that any TLV type is included only once. The `TlvList` is
used when parsing "TLV Request TLV" or preparing which TLVs to
include in an MLE message.
2022-08-11 11:14:09 -07:00
Simon Lin 3120efb486 [thci] restore BBR config for 1.2 BR_1/BR_2 roles (#7997)
BBR related configurations was previously removed for Thread 1.3 BRs.
However, when running 1.2 test case for a Thread 1.3 BR, these
configurations are still necessary.

This commit restores BBR dataset configurations for 1.2 BR_1/BR_2
roles.
2022-08-11 11:08:48 -07:00
Simon Lin f4d93d8fcf [thci] enhance mdns_query to use ip6tables to filter mDNS responses (#8000) 2022-08-11 10:24:52 -07:00
whd df2c11a6cb [tests] add test for Advertising Proxy to publish zero or multiple host addrs (#8003) 2022-08-10 21:24:44 -07:00
Sarah c336a1899f [docs] CLI bbr (#7986) 2022-08-10 17:12:05 -07:00
Abtin Keshavarzian 82ce9dd4c4 [csl] update CSL Channel TLV process to allow for unspecified case (#8005)
This commit updates how unspecified CSL channel is conveyed in MLE
messages. Special value of zero in CSL Channel TLV is used to
indicate that the CSL channel is unspecified. The exclusion of the
TLV keeps the CSL channel as before (no change to the previously
set CSL channel).
2022-08-10 15:00:48 -07:00
Abtin Keshavarzian 967d89cd1a [link-metrics] fix u32 endian-ness in ReportSubTlv (#8006) 2022-08-10 12:11:39 -07:00
Abtin Keshavarzian 9f451a2b32 [mle] fix processing of CSL TLVs (#8004)
This commit contains fixes and enhancements related to processing
of CSL Channel TLV and CSL Clock Accuracy TLV in MLE messages:

- Updates/adds `IsValid()` method to check if TLV is well-formed.
  In particular, we check the TLV length to be at least the
  expecte length (but can be larger) to allow for future changes
  to the TLV format (adding new fields while remaining backward
  compatible).

- Ensure to verify that the read TLV is valid before using its
  content.

 - Fix processing of Accuracy TLV in `HandleChildUpdateResponse()`
   (where we could use incorrect values if TLV was not present).
2022-08-10 10:28:32 -07:00
Abtin Keshavarzian 3a31a5f368 [mle] add array bound check to avoid overflow in HandleDataRequest() (#8002) 2022-08-10 10:26:41 -07:00
Abtin Keshavarzian 3c38af22b4 [mle] helper method appending TLV Request TLV (#8001)
This commit contains smaller enhancements in MLE:

- We use `static const` to define array of TLVs to request.
- Rename the const arrays to `kTlvs`.
- Adds template `AppendTlvRequestTlv()`.
- Adds template `SendDataRequest()`.
2022-08-10 10:22:51 -07:00
Jiachen Dong ba14836b68 [thci] enhance SSH connection (#7981)
Now It connects to OpenThread FTD simulations via SSH without PTY and
runs in non-blocking mode.
2022-08-09 09:21:52 -07:00
Simon Lin 919157d0a6 [thci] generate more logs (#7975) 2022-08-09 09:19:20 -07:00
Jiachen Dong 0a41196540 [thci] add SSH keepalive (#7999)
Add SSH keepalive to avoid disconnection after idle for a long time.
2022-08-08 18:18:21 -07:00
Eduardo Montoya 4ce6a4708d [api] allow CSL receiver to gather parent CSL capabilities (#7991)
This commit extends the Thread API to allow a CSL Receiver application
to adjust its CSL parameters depending on the parent capabilities.

Specifically, it might decide to switch to polling operation instead
of CSL synchronization when the attached parent does not support CSL
Transmitter role (Thread Version 2) or it advertises poor CSL accuracy
or uncertainty.
2022-08-08 11:42:39 -07:00
Eduardo Montoya 5700f90590 [message] document buffer size needs (#7998)
With changes in #7554 the `Metadata` stuct size in `Message` increased,
leading to unsufficient message buffer size when the maximum number
of children is configured, due to the variable size of `ChildMask`.

Furthermore, enabling CoAP Blockwise option also extends the message
buffer size requirements.

This commit documents those cases and makes it clearer
for users how to overcome the possible building issues.
2022-08-08 11:06:59 -07:00
Steven Cooreman 0b41ae0a30 [crypto] allow selecting randomized ECDSA instead of deterministic (#7894)
There is no hard dependency in the Thread specification which requires
the use of deterministic signatures. On the contrary, looking at the
tinycrypt implementation, that one issues randomized ECDSA signatures
and seems to be quite happy with that.

This change does not change the default behaviour, which is to use
deterministic ECDSA when using the default MbedTLS backend. It does
however make it possible for platforms which have qualified hardware
entropy to select 'plain' ECDSA instead, which gives both a performance
and code size improvement on those platforms.
2022-08-08 10:27:12 -07:00
Abtin Keshavarzian cbbed06931 [mesh-forwarder] add Mac::Addresses (src and dst address) (#7990)
This commit adds a new struct `Mac::Addresses` which represents two
MAC addresses corresponding to source and destination. This type
is then used in `MeshForwarder` and `Lowpan` methods allowing us
to pass both source and destination addresses as one parameter.
2022-08-08 09:26:16 -07:00
Abtin Keshavarzian c28496dbd8 [routing-manager] add LocalOnLinkPrefix class (#7989)
This commit simplifies `RoutingManager` by adding a nested class
`LocalOnLinkPrefix` which encapsulates the local on-link prefix
related info and functionality. It tracks the state of the prefix,
i.e. whether we are advertising, deprecating or not including it. It
provides a method to append it as a PIO in an RA message and uses a
timer to keep track of the prefix's lifetime (since the last time it
was advertised in an RA message).

This commit also updated the `test_routing_manager` unit test to add
`TestLocalOnLinkPrefixDeprecation()` checking the deprecation and
expiration of local on-link prefix.
2022-08-08 09:24:10 -07:00
Jiachen Dong 62fcf85106 [thci] change implementation of sniffer simulation from SSH to gRPC (#7983)
The sniffer simulation now supports node filter functionality
(equivalent to RF enclosure in the real world).
2022-08-08 09:19:07 -07:00
whd 24fd146e10 [otci] wait for 2 seconds before retrying a command (#7995)
After a factoryreset the `ot-ctl` may fail to connect to the socket
for ~10 seconds. In such a situation, if OTCI sends a new command,
`execute_command` will receive an exception and will retry the same
command for several times. Such retries will immediately fail because
`ot-ctl` connection is still down and there's no time gap between two
retries.  Hence we should add some wait time before retrying so that
it gives `ot-ctl` some time to recover the connection.
2022-08-08 09:14:33 -07:00
Abtin Keshavarzian b2f8c4adba [cmake] enhance OT CMake config options (allow on/off/unspecified) (#7979)
This commit enhances OT CMake config options allowing them to use 3
values of "on", "off", and unspecified (empty string).

With this change is an `OT_{FEATURE}` option is set to "off", it is
explicitly disabled (`-DOPENTHREAD_CONFIG_{FEATURE}=0` is added which
defines the corresponding OT config as zero). This changes the CMake OT
option behavior from before where "off" was treated as unspecified.

If `OT_{FEATURE}` is left unspecified (or set to empty string), then
the related OT config is not defined by CMake build allowing it to be
to be determined by other means, e.g., a project specific config
header or default config specified in `src/core/config` header files).

This commit adds a CMake macro `ot_option()` to help simplify defining
CMake OT config options. This macro also help emit status messages
indicating the value of each OT config.
2022-08-05 19:56:53 -07:00
Simon Lin 2615d10db8 [border-agent] refine meshcop service state bitmap checks (#7950) 2022-08-04 21:18:19 -07:00
Abtin Keshavarzian cc72e29c88 [lowpan] update ComputeIid() and simplify CompressIid() (#7973)
This commit contains smaller enhancements and fixes in `Lowpan`
related to IID calculation and compression:

- It updates `ComputeIid()` to return `Iid` only.
- `ComputeIid()` now uses the newly added `ApplyPrefix()` which
  ensures the prefix bits are set in IID (if prefix len > 64).
- `CompressIid()` methods are simplified to use `IsLocator()`
   method to determine if the IID matches the locator pattern.
2022-08-04 20:19:56 -07:00
Abtin Keshavarzian 21c5bf7025 [ip6] add ApplyPrefix() to Ip6::InterfaceIdentifier (#7973)
This commit adds a new method `InterfaceIdentifier::ApplyPrefix()`
which applies a given prefix to an IID. This is applicable only when
the prefix length is longer than 64 bit. In this case, only the bits
in the IID up the prefix length are changed to match the prefix and
the remaining bits are left unchanged. This commit also updates the
unit test to validate the behavior of the new method.
2022-08-04 20:19:56 -07:00
Abtin Keshavarzian 3b0738542c [lowpan] update Context and add FindContext() methods (#7971)
This commit contains smaller enhancements in `Lowpan` related to
`Context`. It adds a new member variable `mIsValid` to this struct
which indicates whether we have a valid context. It also adds new
methods `FindContextForId()` and `FindContextToCompressAddress()`.
These methods will either retrieve a related context or `Clear()`
it (to indicate that there is no valid context and also set it ID
to zero which is the default used in lowpan compression).
2022-08-04 07:29:12 -07:00
Abtin Keshavarzian 4116b30c58 [config] add border_routing.h and border_agent.h (#7968)
This commit adds `border_routing.h` and `border_agent.h` header
files for OT configuration related to Border Routing Manager and
Border Agent (removing the definitions from `border_router.h`).
2022-08-04 07:27:10 -07:00
Sarah 9a104a814c [docs] CLI channel (#7957) 2022-08-02 12:54:10 -07:00
Abtin Keshavarzian c096c0e9ca [mesh-forwarder] use FrameBuidler in PrepareDataFrame() (#7964)
This commit updates `MeshForwarder::PrepareDataFrame()` to use
`FrameBuilder` to prepare the frame. It also updates `Lowpan`
fragment header definitions and adds `FirstFrag` and `NextFrag`
nested types. The unit test `test_lowpan` is also updated to
use the new types.
2022-08-02 12:43:51 -07:00
Abtin Keshavarzian e3f157402c [frame-builder] add Insert(), Remove() and other helper methods (#7964)
This commit adds `Insert()` and `Remove()` methods in `FrameBuilder`.
`Insert` can be used to insert new content in the frame at a given
offset moving any previously written content forward. `Remove()` can
be used to remove previously appended content from the frame moving
any content after the removed bytes backward. This commit also adds
`GetRemainingLength()` to get the remaining length (number of bytes
that can be appended) in the frame buffer, and `SetMaxLength()`. Unit
test `test_frame_builder` is also updated to validate all the newly
added methods.
2022-08-02 12:43:51 -07:00
Jonathan Hui 7af484f49f [docker] upgrade pip before installing cmake (#7970) 2022-08-01 21:48:36 -07:00
Jonathan Hui 184aef663a [github-actions] remove clang-6,7,8 from build check (#7969) 2022-08-01 18:48:08 -07:00
Abtin Keshavarzian 600ae09994 [test] update RoutingManager unit test to check default-route (#7940)
This commit updates `test_routing_manager` unit test to validate the
behavior of `RoutingMangaer` related to default route prefix (when AIL
routers advertise default route in RA header or as `::/0` prefix in an
RIO).
2022-08-01 10:44:32 -07:00
Abtin Keshavarzian 4e8eeccfe8 [test] update RoutingManager unit test adding new helper methods (#7951)
This commit updates `test_routing_manager` unit test and adds a new
set of helper methods to simplify the implementation of test-case:

- `VerifyOmrPrefixInNetData()` to check OMR prefix in Network Data.
- `VerifyExternalRoutesInNetData()` to check external route prefixes
   in Network Data.
- `VerifyPrefixTable()` to check the on-link and route prefixes in
  discovered prefix table.
- Different flavors of `SendRouterAdvert()` to send RA with different
  PIOs, RIOs, and default route info (in header).

This commit also breaks the test-cases into multiple functions each
covering specific aspect.
2022-07-28 17:26:49 -07:00
Abtin Keshavarzian 747a0a8069 [mle] fix incorrect StatusTlv when processing Child Update Response (#7956)
This commit fixes `MleRouter::HandleChildUpdateResponse()` to use the
MLE `StatusTlv` instead of `ThreadStatusTlv` when parsing a received
MLE Child Update Response (from a child).
2022-07-28 16:46:54 -07:00
Jonathan Hui 0b1e922a1d [mle] send Link Request immediately if router id was previously allocated (#7947)
After upgrading to a router, the device will wait until it receives a
Route TLV from a neighboring node indicating that the new Router ID
has been allocated. In normal cases, this is not an issue since the
Leader will disseminate a new Router ID Sequence after allocating a
new Router ID. However, in some scenarios, a device may request the
same Router ID that was previously allocated and significantly delay
establishing links with neighboring routers. With this commit, a
device will immediately send a Link Request if the Router ID was
previously allocated.
2022-07-28 07:27:57 -07:00
Abtin Keshavarzian b6ac79f61a [test] fix test_mle_msg_key_seq_jump (#7952)
This commit updates `test_mle_msg_key_seq_jump` to increase the wait
time after key index change for MLE advertisement transmissions. The
MLE advertisement uses trickle timer with max interval of 32 seconds.
Based on this the max interval between two consecutive advertisement
transmissions can be 1.5 times the trickle timer max interval or 48
seconds. The test uses 52 sec as wait time which includes a 4 sec
additional guard time to account for any action and/or message
exchanges after rx of an advertisement. This change should help
address the occasional failures of this test.
2022-07-27 18:58:47 -07:00
Abtin Keshavarzian 1c9373bb0c [mesh-forwarder] allow limiting max num of frames in direct tx queue (#7908)
This commit adds a new feature in `MeshForwarder` to specify a max
limit for the number of frames in tx queue marked for direct
transmission. `OPENTHREAD_CONFIG_MAX_FRAMES_IN_DIRECT_TX_QUEUE`
specifies the maximum number. If set to zero then this behavior is
disabled, i.e., no check is performed on tx queue length.

This commit also adds a new message action log "Dropping (dir queue
full)" which indicates when a message is being dropped due to the
newly added check.
2022-07-27 13:39:51 -07:00
Abtin Keshavarzian c96bf599b7 [toranj] relax test-017-parent-reset-child-recovery pass condition (#7939)
This commit relaxes the pass condition for `test-017` which checks
that after a parent is reset it uses "MLE Child Update Request" to
recover its previous children. This is indirectly validated by
monitoring number of state/role changes on the children. With the
recent change which increases the number of MLE Parent Requests, the
window of time where parent is detached is increased and if during
this time a child tries to send to the parent it can detect that
parent is reset and detach itself causing the test to fail. This
commit relaxes the pass condition to at least one child recovering
using "Child Update" mechanism.
2022-07-27 07:21:44 -07:00
Abtin Keshavarzian 925b12cc08 [routing-manager] rename DiscoveredPrefixTable::Entry method to SetFrom() (#7949)
This commit renames the `DiscoveredPrefixTable::Entry` method to
`SetFrom()` from `InitFrom()` to make it clear that this method can
be used on an existing entry to update it.
2022-07-26 20:53:31 -07:00
Abtin Keshavarzian 12d35f3dfa [routing-manager] ensure to clear the prefix for default route (#7948)
This commit fixes the method setting the prefix table entry from
RA header as a default route by clearing `mPrefix` variable so
to set it as `::/0`.
2022-07-26 20:52:53 -07:00
Jonathan Hui 32ac6ddfad [bootstrap] apply shfmt diffs (#7946) 2022-07-26 14:51:14 -07:00
Abtin Keshavarzian 209716aa19 [routing-manager] enhance selection of prefixes to advertise as RIO (#7936)
This commit updated how `RoutingManager` selects the set of prefixes
to advertise as RIO in emitted RA messages from the BR.  The related
code is now moved to `SendRouterAdvertisement()` method (instead of
previously being in `EvaluateOmrPrefix()`). Since the array for
storing the advertised prefixes has a limited size (configurable
through an OT build-time setting), we add more important prefixes
first in the array to ensure that they are advertised in the RA
message. The following order is used: (1) Local OMR prefix (if
added in Network Data), (2) currently favored OMR prefix, (3) any
other OMR prefixes from Network Data, (4) any other on-mesh prefix
(excluding Domain Prefix) from Network Data.
2022-07-26 12:41:07 -07:00
Abtin Keshavarzian 5755797937 [routing-manager] fix DiscoveredPrefixTable::Entry leak (#7945)
This commit fixes an issue with the potential overwriting of `mNext`
when existing entry in the list is updated (avoid calling `Clear()`).
It also updates `test_routing_manager` to check such a situation
and ensure that the fix is addressing the issue.
2022-07-26 12:24:35 -07:00
Thomas 47b42bb8d9 [ncp] fixes -Werror=missing-field-initializers (#7942)
The uninitialized fields cause compile errors on some systems, this
commit fixes this.
2022-07-26 11:17:36 -07:00
Abtin Keshavarzian a282aa9f9b [core] adding FrameBuilder for constructing frames (#7935)
This commit adds a new class `FrameBuilder` which helps with
construction of frames in a given buffer. It provides helper methods
to append different items to the frame, e.g., bytes from a buffer or
`Message`, a `uint8`, `uint16` or `uint32` value assuming big or
little endian encoding, or a given object. It also provides methods
to overwrite previously appended content in the frame at a given
offset. This class is used in `Lowpan` (replacing `BufferWriter`)
which helps simplify the code. This commit also updates `Appender` to
use the `FrameBuilder` and adds a new unit test for `FrameBuidler`.
2022-07-25 19:59:55 -07:00
Abtin Keshavarzian 5bc71b2a4f [message] allow msg pool using external heap (#7933)
This commit updates the code to allow the config combination of
`OPENTHREAD_CONFIG_MESSAGE_USE_HEAP_ENABLE` along using external heap
`OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE`. This commit updates `Message`
`GetFreeBufferCount()` and `GetTotalBufferCount()` methods to return
special value `0xffff` under this config combo indicating the numbers
cannot be estimated.

This commit also updates `check-simulation-build-autotools` to add
such a build config so to be covered as part OT CI tests.
2022-07-22 15:43:48 -07:00
Abtin Keshavarzian 390efb4c38 [srp-client] add random short delay before sending update message (#7863)
This commit updates the `Srp::Client` to add a randomly chosen short
delay before delay wait time before sending an update message. This
replaces the current model which was adding a fixed short delay.
Selecting the delay randomly helps in situations where some common
event triggers multiple SRP clients on Thread mesh to send an SRP
update(e.g., new OMR prefix causing new addresses, or a server entry
change on Thread Network Data).
2022-07-22 11:16:46 -07:00
Luis Ubieda 1f2a315acf [cmake] update option to enable CoAP Observe through CMake (#7932)
Change the definition of OPENTHREAD_CONFIG_COAP_OBSERVE_API_ENABLE
through target_compile_detinifions().

Signed-off-by: Luis Ubieda <luisubiedas@gmail.com>
2022-07-21 22:25:08 -07:00
Jiachen Dong 12933d3f86 [harness] add functionality to discover and control simulations (#7901)
It can run all the Thread 1.1 test cases with simulations as a role of
Router now except those requiring RF enclosure.
2022-07-21 21:49:34 -07:00
Abtin Keshavarzian 19ca3a0a3c [test] add unit test test_routing_manager (#7927)
This commit adds a unit test for `RoutingManager` which builds a
foundation for writing test cases covering different behaviors of
`RoutingManager`, e.g., validating emitted router advertisements,
sending custom RA messages from different routers on AIL, adding or
removing entries in Network Data while monitoring the behavior of
`RoutingManager`.
2022-07-21 21:43:11 -07:00
Abtin Keshavarzian 96819f934a [routing-manager] new API to get currently favored OMR prefix (#7913)
This commit updates `RoutingManager` to remember the currently favored
OMR prefix (which can be an OMR prefix discovered from Network Data
or device's local OMR prefix). It adds a new public API to retrieve
this prefix and adds a related CLI sub-command.
2022-07-21 21:32:52 -07:00
Abtin Keshavarzian 19181047fd [routing-manager] advertise all on-mesh prefixes as RIOs in emitted RAs (#7900)
This commit changes `RoutingManager` so to include all on-mesh
prefixes from Thread Network Data excluding domain prefix as Route
Info Option in the emitted Router Advertisement messages.
2022-07-21 14:26:21 -07:00
Jonathan Hui 6809b33f31 [github-actions] update to macos-12 (#7930)
macos-10.15 is deprecated.
2022-07-21 13:08:26 -07:00
Yi bec3a5edb0 [nat64] fix build options for NAT64 tests (#7929)
This commit fixes the build options for NAT64 tests. A new option was
added in ot-br-posix recently.
2022-07-21 07:22:27 -07:00
Eduardo Montoya 424005f695 [csl] test resync after parent is down for a long period (#7915)
Add test steps to verify that a CSL Receiver is able to re-establish
CSL synchronization after its peer has been absent for a long period.
2022-07-20 15:11:34 -07:00
Abtin Keshavarzian 7b60716713 [csl] ensure SubMacis informed when CSL support changes (#7918)
This commit changes `Mac::UpdateCsl()` to ensure we inform `SubMac`
and disable CSL when CSL support changes (e.g., device gets
detached). This ensures that `SubMac` internal variables (CSL period,
channel) are updated on a detach and if the device later attaches
again, we detect the change in CSL configuration and trigger the tx
of MLE Child Update Request.
2022-07-20 15:11:34 -07:00
Paweł Wańczyk ed0334f626 [routing-table] do not reset LastHeard timestamp when removing router link (#7879) 2022-07-20 15:09:28 -07:00
Abtin Keshavarzian f98f89adfe [core] replace uses of OT_ERROR_{} with kError{} in core modules (#7919) 2022-07-19 21:45:55 -07:00
Robert Quattlebaum 8095a086d7 [bootstrap] Explicitly use arm-none-eabi-gcc from armmbed (#7917)
The bootstrap script taps `armmbed/formulae`, and then tries
to install `arm-none-eabi-gcc` from that tap. However, if the
user has already tapped a different tap that offers
`arm-none-eabi-gcc`, then the install will fail.

This change removes the ambiguity of the install by specifying
the tap to use.
2022-07-19 14:35:19 -07:00
Sarah c73db3ff2f [docs] add NAT64 to Doxygen (#7916)
I added the group definition under IPv6 Networking.
2022-07-19 13:21:20 -07:00
Simon Lin e538aad095 [thci] find border agents with non link-local addresses (#7853)
Thread BR may advertise IPv6 GUA rather than LLA. For example, Avahi
stops publishing LLA when any GUA is found on the network interface.

This commit enhances mdns_query to find border agents with
non-link-local addresses.
2022-07-19 09:12:17 -07:00
Simon Lin 6242a1e68e [thci] allow to specify custom commands (#7912)
This commit uses `Param9` to specify custom commands for Thread BR
THCI to control `otbr-agent`.
2022-07-19 08:51:20 -07:00
Yi 095f530bd7 [nat64] run nat64 ci tests as an independent job (#7885)
This commit changes the NAT64 CI tests to be ran as an independent
job. A new /nat64 folder is added and it would make it easier to
configure new NAT64 tests in the future.
2022-07-18 14:15:00 -07:00
Eduardo Montoya a68cd059cc [csl] update CSL information in radio when parent changes (#7911)
Cover the case of parent change while the CSL child is still attached.
2022-07-18 14:12:20 -07:00
Abtin Keshavarzian ec96609070 [test] fix "unused result warning" in newly updated unit tests (#7905) 2022-07-18 14:10:54 -07:00
Sarah 78f8437c3b [docs] update CLI comments (#7902) 2022-07-16 18:41:13 -07:00
Yakun Xu 793483da0d [size-report] fix markdown viewer (#7906) 2022-07-16 08:19:14 -07:00
Song GUO 03c9b9389d [nat64] add functions for processing IPv4 packets (#7824)
With NAT64, we need to handle the IPv4 packets inside the border
router functions in OpenThread core.

This commit introduces a few new classes for NAT64:
- Add `Ip4::Cidr` (for specifying CIDR block of translated packets)
- Updated Ip4 address format -- use a union of (m8[4], m16[2], m32)
  instead of 4 bytes.
- Extend `Checksum` for supporting ICMP in Ip4 (and TCP4 / UDP4) and
  IPv4 header.
2022-07-15 10:54:20 -07:00
Abtin Keshavarzian 13416b15fb [core] adding FrameData class for parsing frames (#7892)
This commit adds a new class `FrameData` which is a sub-class of
`Data` (acts as a wrapper over a buffer pointer and a length). It is
used in `MeshForwarder` and `Lowpan` to simplify the method calls
(can pass `FrameData` instance instead of pointer and length). It
also provides helper methods for parsing the frame content (e.g.,
reading `uint16/32` value assuming big or little endian encoding).
When read successfully, the `FrameData` is updated to skip over the
read content. These methods help simplify `Lowpan` parsing and
decompression code. In particular the `Lowpan` methods now directly
update the passed-in `FrameData` to skip over the parsed header
portion (instead of returning the parsed header length).
2022-07-14 17:04:47 -07:00
Zhanglong Xia 366786dbed [posix] add a vendor interface for the radio spinel layer (#7884)
This commit adds a vendor interface for developers to implement
the bus interface by themselves.
2022-07-14 13:10:51 -07:00
Abtin Keshavarzian 0ec9612379 [docs] add plat-infra-if and api-border-routing doxygen groups (#7898) 2022-07-13 19:59:47 -07:00
Eduardo Montoya 648770a8ad [cli] fix endif comment (#7896) 2022-07-13 08:11:27 -07:00
Abtin Keshavarzian 78e3b28127 [routing-manager] fix typos in method/variable names (#7895) 2022-07-12 10:51:12 -07:00
Abtin Keshavarzian 158e59f267 [tmf] update IsTmfMessage() method (#7875)
This commit updates `Tmf::IsTmfMessage()` method to check source and
destination addresses. This change helps make this method more
generic(allow it to be used for both rx/tx messages). This commit
also simplifies the implementation (avoid using complex expression
containing multiple `&&` and `||`).
2022-07-12 10:15:34 -07:00
Abtin Keshavarzian eca7a63adc [toranj] make test-017 more robust (#7888)
This commit updates `test-017-parent-reset-child-recovery.py` to make
it more robust by increasing the wait time for children to be
recovered after parent/leader reset. This is related to the increase
in data poll period of sleepy children to 10 sec which was done
previously to accommodate for the increased start-up time of leader
(due to change in number of MLE Parent Requests).
2022-07-11 11:59:34 -07:00
Abtin Keshavarzian 6e0eb8addf [mesh-forwarder] simplify CheckReachability() and Icmp::SendError() (#7887)
A new flavor of `Icmp::SendError()` is added which allows the caller
to provide the parsed `Ip6::Headers` of the error-causing message
instead the full `Message` instance. Note that the implementation of
`SendError()` only includes the IPv6 header of the error-causing
message in the payload of the ICMPv6 error message.

`MeshForwarder::CheckReachability()` method is updated to use the
recently added `Ip6::Headers` to parse the IPv6 headers from the
received frame. With the changes in this commit, we no longer need to
allocate a temporary `Message` which was used for reading the
decompressed IPv6 header and also to pass to `Icmp::SendError()` in
case of "destination unreachable" error.
2022-07-11 11:59:06 -07:00
Abtin Keshavarzian 5876ff79ae [routing-manager] add public API to get discovered prefix table (#7877)
This commit adds new public OT APIs to iterate over the Border Router
discovered prefix table from received Router Advertisement messages.
It also adds new CLI command to output the prefix table. The new APIs
are primary intended for testing.
2022-07-11 11:58:27 -07:00
Abtin Keshavarzian 75ecf8d260 [api] add border_routing.h header for otBorderRouting APIs (#7877)
This commit adds `<openthread/border_routing.h`> header and moves
all the `otBorderRouting` APIs (which are related to Border Routing
Manager) into this header. It also adds a note that these APIs are
available when `OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE` is enabled.
It also adds `border_routing_api.cpp` source file for the API
implementation.
2022-07-11 11:58:27 -07:00
529 changed files with 29165 additions and 12992 deletions
+33 -33
View File
@@ -30,20 +30,16 @@ name: Build
on: [push, pull_request]
jobs:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || (github.repository == 'openthread/openthread' && github.run_id) || github.ref }}
cancel-in-progress: true
cancel-previous-runs:
runs-on: ubuntu-20.04
steps:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "github.ref != 'refs/heads/main'"
jobs:
pretty:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- name: Bootstrap
@@ -59,21 +55,22 @@ jobs:
markdown-lint-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
use-verbose-mode: 'yes'
max-depth: 3
cmake-version:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- name: Bootstrap
run: |
sudo pip3 install --system -U cmake==3.10.3
sudo pip3 install -U scikit-build
sudo pip3 install -U cmake==3.10.3
cmake --version | grep 3.10.3
sudo apt-get --no-install-recommends install -y ninja-build libreadline-dev libncurses-dev
- name: Build
@@ -97,7 +94,7 @@ jobs:
CC: ${{ matrix.compiler_c }}
CXX: ${{ matrix.compiler_cpp }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- name: Bootstrap
@@ -111,7 +108,7 @@ jobs:
scan-build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- name: Bootstrap
@@ -123,19 +120,19 @@ jobs:
script/check-scan-build
mbedtls3-build:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- name: Bootstrap
run: |
sudo apt-get --no-install-recommends install -y ninja-build libreadline-dev libncurses-dev
rm -rf third_party/mbedtls/repo
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
repository: ARMmbed/mbedtls
ref: v3.1.0
ref: v3.2.1
path: third_party/mbedtls/repo
- name: Build
run: |
@@ -143,7 +140,7 @@ jobs:
arm-gcc:
name: arm-gcc-${{ matrix.gcc_ver }}
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
@@ -164,7 +161,7 @@ jobs:
gcc_download_url: https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2019q4/RC2.1/gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2
gcc_extract_dir: gcc-arm-none-eabi-9-2019-q4-major
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- name: Bootstrap
@@ -175,25 +172,28 @@ jobs:
wget --tries 4 --no-check-certificate --quiet ${{ matrix.gcc_download_url }} -O gcc-arm.tar.bz2
tar xjf gcc-arm.tar.bz2
# use the minimal required cmake version
sudo pip3 install --system -U cmake==3.10.3
sudo pip3 install -U scikit-build
sudo pip3 install -U cmake==3.10.3
cmake --version | grep 3.10.3
- name: Build
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
run: |
export PATH=/tmp/${{ matrix.gcc_extract_dir }}/bin:$PATH
script/check-arm-build
gcc:
name: gcc-${{ matrix.gcc_ver }}
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
gcc_ver: [5, 6, 7, 8, 9, 10, 11]
gcc_ver: [9, 10, 11, 12]
env:
CC: gcc-${{ matrix.gcc_ver }}
CXX: g++-${{ matrix.gcc_ver }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- name: Bootstrap
@@ -216,12 +216,12 @@ jobs:
strategy:
fail-fast: false
matrix:
clang_ver: ["6.0", "7", "8", "9", "10", "11", "12", "13"]
clang_ver: ["9", "10", "11", "12", "13"]
env:
CC: clang-${{ matrix.clang_ver }}
CXX: clang++-${{ matrix.clang_ver }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- name: Bootstrap
@@ -246,7 +246,7 @@ jobs:
strategy:
fail-fast: false
matrix:
clang_ver: ["6.0", "7", "8", "9", "10", "11", "12", "13"]
clang_ver: ["9", "10", "11", "12", "13"]
env:
CC: clang-${{ matrix.clang_ver }}
CXX: clang++-${{ matrix.clang_ver }}
@@ -254,7 +254,7 @@ jobs:
CXXFLAGS: -m32 -Wconversion
LDFLAGS: -m32
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- name: Bootstrap
@@ -277,7 +277,7 @@ jobs:
gn:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- name: Bootstrap
@@ -303,12 +303,12 @@ jobs:
CXX: clang++
- CC: gcc
CXX: g++
runs-on: macos-10.15
runs-on: macos-12
env:
CC: ${{ matrix.CC }}
CXX: ${{ matrix.CXX }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- name: Bootstrap
@@ -326,7 +326,7 @@ jobs:
android:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- name: Build
+5 -9
View File
@@ -30,15 +30,11 @@ name: Docker
on: [push, pull_request]
jobs:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || (github.repository == 'openthread/openthread' && github.run_id) || github.ref }}
cancel-in-progress: true
cancel-previous-runs:
runs-on: ubuntu-20.04
steps:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "github.ref != 'refs/heads/main'"
jobs:
buildx:
name: buildx-${{ matrix.docker_name }}
@@ -49,7 +45,7 @@ jobs:
include:
- docker_name: environment
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
+6
View File
@@ -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
+5 -9
View File
@@ -30,19 +30,15 @@ name: Makefile Check
on: [push, pull_request]
jobs:
cancel-previous-runs:
runs-on: ubuntu-20.04
steps:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "github.ref != 'refs/heads/main'"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || (github.repository == 'openthread/openthread' && github.run_id) || github.ref }}
cancel-in-progress: true
jobs:
makefile-check:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- name: Check
+27 -18
View File
@@ -30,15 +30,11 @@ name: Border Router
on: [push, pull_request]
jobs:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || (github.repository == 'openthread/openthread' && github.run_id) || github.ref }}
cancel-in-progress: true
cancel-previous-runs:
runs-on: ubuntu-20.04
steps:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "github.ref != 'refs/heads/main'"
jobs:
backbone-router:
runs-on: ubuntu-20.04
@@ -57,7 +53,7 @@ jobs:
# of OMR prefix and Domain prefix is not deterministic.
BORDER_ROUTING: 0
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- name: Build OTBR Docker
@@ -81,11 +77,11 @@ jobs:
export CI_ENV="$(bash <(curl -s https://codecov.io/env)) -e GITHUB_ACTIONS -e COVERAGE"
echo "CI_ENV=${CI_ENV}"
sudo -E ./script/test cert_suite ./tests/scripts/thread-cert/backbone/*.py || (sudo chmod a+r *.log *.json *.pcap && false)
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: cov-thread-1-3-backbone-docker
path: /tmp/coverage/
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: thread-1-3-backbone-results
@@ -98,7 +94,7 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: cov-thread-1-3-backbone
path: tmp/coverage.info
@@ -113,31 +109,43 @@ jobs:
otbr_trel: 0
cert_scripts: ./tests/scripts/thread-cert/border_router/*.py
packet_verification: 1
nat64: 0
description: ""
- otbr_mdns: "mDNSResponder"
otbr_trel: 1
cert_scripts: ./tests/scripts/thread-cert/border_router/*.py
packet_verification: 2
nat64: 0
description: ""
- otbr_mdns: "mDNSResponder"
otbr_trel: 0
cert_scripts: ./tests/scripts/thread-cert/border_router/MATN/*.py
packet_verification: 1
nat64: 0
description: "MATN"
- otbr_mdns: "mDNSResponder"
otbr_trel: 0
cert_scripts: ./tests/scripts/thread-cert/border_router/LowPower/*.py
packet_verification: 1
nat64: 0
description: "LowPower"
- otbr_mdns: "mDNSResponder"
otbr_trel: 0
cert_scripts: ./tests/scripts/thread-cert/border_router/nat64/*.py
packet_verification: 1
nat64: 1
description: "nat64 openthread"
- otbr_mdns: "avahi"
otbr_trel: 0
cert_scripts: ./tests/scripts/thread-cert/border_router/*.py
packet_verification: 1
nat64: 0
description: ""
- otbr_mdns: "avahi"
otbr_trel: 1
cert_scripts: ./tests/scripts/thread-cert/border_router/*.py
packet_verification: 2
nat64: 0
description: ""
name: BR ${{ matrix.description }} (${{ matrix.otbr_mdns }}, TREL=${{matrix.otbr_trel}})
env:
@@ -152,9 +160,10 @@ jobs:
PYTHONUNBUFFERED: 1
VERBOSE: 1
BORDER_ROUTING: 1
NAT64: ${{ matrix.nat64 }}
MAX_JOBS: 3
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Build OTBR Docker
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
@@ -177,11 +186,11 @@ jobs:
export CI_ENV="$(bash <(curl -s https://codecov.io/env)) -e GITHUB_ACTIONS -e COVERAGE"
echo "CI_ENV=${CI_ENV}"
sudo -E ./script/test cert_suite ${{ matrix.cert_scripts }} || (sudo chmod a+r *.log *.json *.pcap && false)
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: cov-thread-border-router-docker
path: /tmp/coverage/
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: thread-border-router-results
@@ -194,7 +203,7 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: cov-thread-border-router
path: tmp/coverage.info
@@ -205,7 +214,7 @@ jobs:
- thread-border-router
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- name: Bootstrap
@@ -229,7 +238,7 @@ jobs:
needs: upload-coverage
runs-on: ubuntu-20.04
steps:
- uses: geekyeggo/delete-artifact@1-glob-support
- uses: geekyeggo/delete-artifact@v2
with:
name: cov-*
useGlob: true
+5 -9
View File
@@ -30,15 +30,11 @@ name: OTCI
on: [push, pull_request]
jobs:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || (github.repository == 'openthread/openthread' && github.run_id) || github.ref }}
cancel-in-progress: true
cancel-previous-runs:
runs-on: ubuntu-20.04
steps:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "github.ref != 'refs/heads/main'"
jobs:
cli-sim:
name: cli-sim VIRTUAL_TIME=${{ matrix.virtual_time }}
@@ -52,7 +48,7 @@ jobs:
VIRTUAL_TIME: ${{ matrix.virtual_time }}
REAL_DEVICE: 0
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Bootstrap
run: |
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
+14 -18
View File
@@ -30,6 +30,10 @@ name: OTNS
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || (github.repository == 'openthread/openthread' && github.run_id) || github.ref }}
cancel-in-progress: true
env:
COVERAGE: 1
REFERENCE_DEVICE: 1
@@ -40,19 +44,11 @@ env:
jobs:
cancel-previous-runs:
runs-on: ubuntu-20.04
steps:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "github.ref != 'refs/heads/main'"
unittests:
name: Unittests
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions/setup-go@v1
with:
go-version: '1.14'
@@ -73,7 +69,7 @@ jobs:
cd /tmp/otns
./script/test py-unittests
)
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: unittests-pcaps
@@ -83,7 +79,7 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: cov-otns-unittests
path: tmp/coverage.info
@@ -92,7 +88,7 @@ jobs:
name: Examples
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions/setup-go@v1
with:
go-version: '1.14'
@@ -113,7 +109,7 @@ jobs:
cd /tmp/otns
./script/test py-examples
)
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: examples-pcaps
@@ -123,7 +119,7 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: cov-otns-examples
path: tmp/coverage.info
@@ -150,7 +146,7 @@ jobs:
env:
STRESS_LEVEL: ${{ matrix.stress_level }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions/setup-go@v1
with:
go-version: '1.14'
@@ -171,7 +167,7 @@ jobs:
cd /tmp/otns
./script/test stress-tests ${{ matrix.suite }}
)
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: stress-tests-${{ matrix.suite }}-pcaps
@@ -181,7 +177,7 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: cov-otns-stress-tests-${{ matrix.suite }}
path: tmp/coverage.info
@@ -193,7 +189,7 @@ jobs:
- stress-tests
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Bootstrap
run: |
sudo apt-get --no-install-recommends install -y lcov
+39 -33
View File
@@ -30,23 +30,19 @@ name: POSIX
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || (github.repository == 'openthread/openthread' && github.run_id) || github.ref }}
cancel-in-progress: true
jobs:
cancel-previous-runs:
runs-on: ubuntu-20.04
steps:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "github.ref != 'refs/heads/main'"
expects-linux:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
env:
CFLAGS: -DCLI_COAP_SECURE_USE_COAP_DEFAULT_HANDLER=1 -DOPENTHREAD_CONFIG_MLE_MAX_CHILDREN=15
CXXFLAGS: -DCLI_COAP_SECURE_USE_COAP_DEFAULT_HANDLER=1 -DOPENTHREAD_CONFIG_MLE_MAX_CHILDREN=15
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Bootstrap
run: |
sudo apt-get --no-install-recommends install -y expect ninja-build lcov socat
@@ -61,7 +57,7 @@ jobs:
CRASHED=$(./script/test check_crash | tail -1)
[[ $CRASHED -eq "1" ]] && echo "Crashed!" || echo "Not crashed."
echo "CRASHED_RCP=$CRASHED" >> $GITHUB_ENV
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
if: ${{ failure() && env.CRASHED_RCP == '1' }}
with:
name: core-expect-rcp
@@ -70,19 +66,18 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: cov-expects-linux-1
path: tmp/coverage.info
- name: Run TUN Mode
run: |
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
sudo apt-get install --no-install-recommends -y dnsmasq bind9-host ntp
sudo systemctl start dnsmasq ntp
host ipv6.google.com 127.0.0.1
echo 'listen-address=::1' | sudo tee /etc/dnsmasq.conf
echo 0 | sudo tee /proc/sys/net/ipv6/conf/all/disable_ipv6
sudo systemctl restart dnsmasq
sudo apt-get install --no-install-recommends -y bind9-host ntp socat
sudo systemctl restart ntp
sudo socat 'UDP6-LISTEN:53,fork,reuseaddr,bind=[::1]' UDP:127.0.0.53:53 &
host ipv6.google.com 127.0.0.53
host ipv6.google.com ::1
ulimit -c unlimited
./script/test prepare_coredump_upload
@@ -93,13 +88,13 @@ jobs:
CRASHED=$(./script/test check_crash | tail -1)
[[ $CRASHED -eq "1" ]] && echo "Crashed!" || echo "Not crashed."
echo "CRASHED_TUN=$CRASHED" >> $GITHUB_ENV
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
if: ${{ failure() && env.CRASHED_TUN == '1' }}
with:
name: core-expect-linux
path: |
./ot-core-dump/*
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: syslog-expect-linux
@@ -107,10 +102,21 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: cov-expects-linux-2
path: tmp/coverage.info
tcplp-buffering:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Build
run: make -C third_party/tcplp/lib/test/
- name: Run
run: third_party/tcplp/lib/test/test_all
thread-cert:
runs-on: ubuntu-20.04
@@ -123,7 +129,7 @@ jobs:
VIRTUAL_TIME: 1
VIRTUAL_TIME_UART: 1
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- name: Bootstrap
@@ -139,7 +145,7 @@ jobs:
- name: Run
run: |
VERBOSE=1 OT_CLI_PATH="$PWD/output/posix/bin/ot-cli -v" RADIO_DEVICE="$PWD/output/simulation/bin/ot-rcp" make -f src/posix/Makefile-posix check
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: thread-cert
@@ -147,7 +153,7 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: cov-thread-cert
path: tmp/coverage.info
@@ -157,7 +163,7 @@ jobs:
env:
COVERAGE: 1
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- name: Bootstrap
@@ -174,7 +180,7 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: cov-ncp-rcp-migrate
path: tmp/coverage.info
@@ -191,7 +197,7 @@ jobs:
OT_DAEMON: ${{ matrix.OT_DAEMON }}
OT_READLINE: 'readline'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Bootstrap
run: |
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
@@ -219,14 +225,14 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: cov-pty-linux-${{ matrix.DAEMON }}
path: tmp/coverage.info
pty-macos:
name: pty-macos OT_DAEMON=${{ matrix.OT_DAEMON }}
runs-on: macos-10.15
runs-on: macos-12
strategy:
fail-fast: false
matrix:
@@ -235,7 +241,7 @@ jobs:
OT_DAEMON: ${{ matrix.OT_DAEMON }}
OT_READLINE: 'off'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Bootstrap
run: |
rm -f '/usr/local/bin/2to3'
@@ -251,7 +257,7 @@ jobs:
rcp-stack-reset:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Bootstrap
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
@@ -267,7 +273,7 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: cov-rcp-stack-reset
path: tmp/coverage.info
@@ -280,7 +286,7 @@ jobs:
- thread-cert
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- name: Bootstrap
@@ -302,7 +308,7 @@ jobs:
needs: upload-coverage
runs-on: ubuntu-20.04
steps:
- uses: geekyeggo/delete-artifact@1-glob-support
- uses: geekyeggo/delete-artifact@v2
with:
name: cov-*
useGlob: true
+28 -32
View File
@@ -30,15 +30,11 @@ name: Simulation 1.1
on: [push, pull_request]
jobs:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || (github.repository == 'openthread/openthread' && github.run_id) || github.ref }}
cancel-in-progress: true
cancel-previous-runs:
runs-on: ubuntu-20.04
steps:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "github.ref != 'refs/heads/main'"
jobs:
distcheck:
runs-on: ubuntu-20.04
@@ -49,7 +45,7 @@ jobs:
THREAD_VERSION: 1.1
VIRTUAL_TIME: 1
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- name: Bootstrap
@@ -75,7 +71,7 @@ jobs:
VIRTUAL_TIME: 1
MULTIPLY: 3
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- name: Bootstrap
@@ -92,7 +88,7 @@ jobs:
- name: Run
run: |
./script/test cert_suite ./tests/scripts/thread-cert/Cert_*.py ./tests/scripts/thread-cert/test_*.py
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: packet-verification-pcaps
@@ -102,7 +98,7 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: cov-packet-verification
path: tmp/coverage.info
@@ -118,7 +114,7 @@ jobs:
THREAD_VERSION: 1.1
VIRTUAL_TIME: 1
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- name: Bootstrap
@@ -133,7 +129,7 @@ jobs:
- name: Run
run: |
VERBOSE=1 make -f examples/Makefile-simulation check
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: cli-ftd-thread-cert
@@ -141,7 +137,7 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: cov-cli-ftd
path: tmp/coverage.info
@@ -164,7 +160,7 @@ jobs:
VIRTUAL_TIME: 1
MESSAGE_USE_HEAP: ${{ matrix.message_use_heap }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- name: Bootstrap
@@ -179,7 +175,7 @@ jobs:
- name: Run
run: |
VERBOSE=1 make -f examples/Makefile-simulation check
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: cli-mtd-thread-cert
@@ -187,7 +183,7 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: cov-cli-mtd-${{ matrix.message_use_heap }}
path: tmp/coverage.info
@@ -204,7 +200,7 @@ jobs:
TIME_SYNC: 1
VIRTUAL_TIME: 1
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- name: Bootstrap
@@ -219,7 +215,7 @@ jobs:
- name: Run
run: |
VERBOSE=1 make -f examples/Makefile-simulation check
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: cli-time-sync-thread-cert
@@ -227,19 +223,19 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: cov-cli-time-sync
path: tmp/coverage.info
expects:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
env:
CFLAGS: -DCLI_COAP_SECURE_USE_COAP_DEFAULT_HANDLER=1 -DOPENTHREAD_CONFIG_MLE_MAX_CHILDREN=15
CXXFLAGS: -DCLI_COAP_SECURE_USE_COAP_DEFAULT_HANDLER=1 -DOPENTHREAD_CONFIG_MLE_MAX_CHILDREN=15
THREAD_VERSION: 1.1
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Bootstrap
run: |
sudo apt-get --no-install-recommends install -y expect ninja-build lcov socat
@@ -254,7 +250,7 @@ jobs:
CRASHED=$(./script/test check_crash | tail -1)
[[ $CRASHED -eq "1" ]] && echo "Crashed!" || echo "Not crashed."
echo "CRASHED_CLI=$CRASHED" >> $GITHUB_ENV
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
if: ${{ failure() && env.CRASHED_CLI == '1' }}
with:
name: core-expect-cli
@@ -263,7 +259,7 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: cov-expects
path: tmp/coverage.info
@@ -273,7 +269,7 @@ jobs:
env:
THREAD_VERSION: 1.1
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- name: Bootstrap
@@ -306,7 +302,7 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: cov-ot-commissioner
path: tmp/coverage.info
@@ -321,7 +317,7 @@ jobs:
VIRTUAL_TIME: 1
CXXFLAGS: "-DOPENTHREAD_CONFIG_LOG_PREPEND_UPTIME=0"
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- name: Bootstrap
@@ -335,7 +331,7 @@ jobs:
- name: Run
run: |
VERBOSE=1 make -f examples/Makefile-simulation check
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: multiple-instance-thread-cert
@@ -343,7 +339,7 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: cov-multiple-instance
path: tmp/coverage.info
@@ -359,7 +355,7 @@ jobs:
- multiple-instance
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- name: Bootstrap
@@ -381,7 +377,7 @@ jobs:
needs: upload-coverage
runs-on: ubuntu-20.04
steps:
- uses: geekyeggo/delete-artifact@1-glob-support
- uses: geekyeggo/delete-artifact@v2
with:
name: cov-*
useGlob: true
+24 -28
View File
@@ -30,15 +30,11 @@ name: Simulation 1.3
on: [push, pull_request]
jobs:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || (github.repository == 'openthread/openthread' && github.run_id) || github.ref }}
cancel-in-progress: true
cancel-previous-runs:
runs-on: ubuntu-20.04
steps:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "github.ref != 'refs/heads/main'"
jobs:
thread-1-3:
name: thread-1-3-${{ matrix.compiler.c }}-${{ matrix.arch }}
@@ -59,7 +55,7 @@ jobs:
compiler: [{c: "gcc", cxx: "g++", gcov: "gcc"}, { c: "clang-10", cxx: "clang++-10", gcov: "llvm"}]
arch: ["m32", "m64"]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- name: Bootstrap
@@ -84,12 +80,12 @@ jobs:
CRASHED=$(./script/test check_crash | tail -1)
[[ $CRASHED -eq "1" ]] && echo "Crashed!" || echo "Not crashed."
echo "CRASHED=$CRASHED" >> $GITHUB_ENV
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: thread-1-3-${{ matrix.compiler.c }}-${{ matrix.arch }}-pcaps
path: "*.pcap"
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
if: ${{ failure() && env.CRASHED == '1' }}
with:
name: core-packet-verification-thread-1-3
@@ -98,7 +94,7 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage "${{ matrix.compiler.gcov }}"
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: cov-thread-1-3-${{ matrix.compiler.c }}-${{ matrix.arch }}
path: tmp/coverage.info
@@ -115,7 +111,7 @@ jobs:
INTER_OP: 1
INTER_OP_BBR: 0
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- name: Bootstrap
@@ -143,14 +139,14 @@ jobs:
CRASHED=$(./script/test check_crash | tail -1)
[[ $CRASHED -eq "1" ]] && echo "Crashed!" || echo "Not crashed."
echo "CRASHED=$CRASHED" >> $GITHUB_ENV
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: packet-verification-low-power-pcaps
path: |
*.pcap
*.json
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
if: ${{ failure() && env.CRASHED == '1' }}
with:
name: core-packet-verification-low-power
@@ -159,7 +155,7 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: cov-packet-verification-low-power
path: tmp/coverage.info
@@ -173,7 +169,7 @@ jobs:
THREAD_VERSION: 1.3
MULTIPLY: 3
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- name: Bootstrap
@@ -190,7 +186,7 @@ jobs:
- name: Run
run: |
./script/test cert_suite ./tests/scripts/thread-cert/Cert_*.py ./tests/scripts/thread-cert/test_*.py
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: packet-verification-1.1-on-1.3-pcaps
@@ -200,7 +196,7 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: cov-packet-verification-1-1-on-1-3
path: tmp/coverage.info
@@ -212,7 +208,7 @@ jobs:
THREAD_VERSION: 1.3
VIRTUAL_TIME: 0
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- name: Bootstrap
@@ -229,7 +225,7 @@ jobs:
CRASHED=$(./script/test check_crash | tail -1)
[[ $CRASHED -eq "1" ]] && echo "Crashed!" || echo "Not crashed."
echo "CRASHED=$CRASHED" >> $GITHUB_ENV
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
if: ${{ failure() && env.CRASHED == '1' }}
with:
name: core-expect-1-3
@@ -238,7 +234,7 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: cov-expects
path: tmp/coverage.info
@@ -255,7 +251,7 @@ jobs:
VIRTUAL_TIME: 1
INTER_OP: 1
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- name: Bootstrap
@@ -282,12 +278,12 @@ jobs:
CRASHED=$(./script/test check_crash | tail -1)
[[ $CRASHED -eq "1" ]] && echo "Crashed!" || echo "Not crashed."
echo "CRASHED=$CRASHED" >> $GITHUB_ENV
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: thread-1-3-posix-pcaps
path: "*.pcap"
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
if: ${{ failure() && env.CRASHED == '1' }}
with:
name: core-thread-1-3-posix
@@ -296,7 +292,7 @@ jobs:
- name: Generate Coverage
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: cov-thread-1-3-posix
path: tmp/coverage.info
@@ -310,7 +306,7 @@ jobs:
- thread-1-3-posix
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- name: Bootstrap
@@ -332,7 +328,7 @@ jobs:
needs: upload-coverage
runs-on: ubuntu-20.04
steps:
- uses: geekyeggo/delete-artifact@1-glob-support
- uses: geekyeggo/delete-artifact@v2
with:
name: cov-*
useGlob: true
+6 -10
View File
@@ -30,25 +30,21 @@ name: Size
on: [push, pull_request]
jobs:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || (github.repository == 'openthread/openthread' && github.run_id) || github.ref }}
cancel-in-progress: true
cancel-previous-runs:
runs-on: ubuntu-20.04
steps:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "github.ref != 'refs/heads/main'"
jobs:
size-report:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Bootstrap
if: "github.event_name == 'push'"
run: |
python3 -m pip install --upgrade setuptools wheel
python3 -m pip install mdv
python3 -m pip install git+https://github.com/axiros/terminal_markdown_viewer.git
- name: Run
env:
OT_BASE_BRANCH: "${{ github.base_ref }}"
+39 -19
View File
@@ -30,19 +30,15 @@ name: Toranj
on: [push, pull_request]
jobs:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || (github.repository == 'openthread/openthread' && github.run_id) || github.ref }}
cancel-in-progress: true
cancel-previous-runs:
runs-on: ubuntu-20.04
steps:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "github.ref != 'refs/heads/main'"
jobs:
toranj-ncp:
name: toranj-ncp-${{ matrix.TORANJ_RADIO }}
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
@@ -51,7 +47,7 @@ jobs:
COVERAGE: 1
TORANJ_RADIO : ${{ matrix.TORANJ_RADIO }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- name: Bootstrap
@@ -61,12 +57,15 @@ jobs:
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
sudo apt-get --no-install-recommends install -y dbus libdbus-1-dev
sudo apt-get --no-install-recommends install -y autoconf-archive
sudo apt-get --no-install-recommends install -y bsdtar
sudo apt-get --no-install-recommends install -y libarchive-tools
sudo apt-get --no-install-recommends install -y libtool
sudo apt-get --no-install-recommends install -y libglib2.0-dev
sudo apt-get --no-install-recommends install -y libboost-dev libboost-signals-dev
sudo apt-get --no-install-recommends install -y lcov
sudo add-apt-repository universe
sudo apt-get update
sudo apt-get --no-install-recommends install -y libboost-all-dev python2
script/git-tool clone --depth=1 --branch=master https://github.com/openthread/wpantund.git
cd wpantund
./bootstrap.sh
@@ -80,7 +79,7 @@ jobs:
if: "matrix.TORANJ_RADIO != 'multi'"
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
if: "matrix.TORANJ_RADIO != 'multi'"
with:
name: cov-toranj-ncp-${{ matrix.TORANJ_RADIO }}
@@ -88,7 +87,7 @@ jobs:
toranj-cli:
name: toranj-cli-${{ matrix.TORANJ_RADIO }}
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
strategy:
matrix:
TORANJ_RADIO: ['15.4']
@@ -97,7 +96,7 @@ jobs:
TORANJ_RADIO : ${{ matrix.TORANJ_RADIO }}
TORANJ_CLI: 1
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- name: Bootstrap
@@ -114,19 +113,40 @@ jobs:
if: "matrix.TORANJ_RADIO != 'multi'"
run: |
./script/test generate_coverage gcc
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
if: "matrix.TORANJ_RADIO != 'multi'"
with:
name: cov-toranj-cli-${{ matrix.TORANJ_RADIO }}
path: tmp/coverage.info
toranj-unittest:
name: toranj-unittest
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Bootstrap
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get --no-install-recommends install -y clang-10 clang++-10 ninja-build python3-setuptools python3-wheel llvm lcov
sudo apt-get --no-install-recommends install -y g++-multilib libreadline-dev:i386 libncurses-dev:i386
python3 -m pip install -r tests/scripts/thread-cert/requirements.txt
- name: Build & Run
run: |
./tests/toranj/build.sh cmake
ninja test
upload-coverage:
needs:
- toranj-ncp
- toranj-cli
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- name: Bootstrap
@@ -148,7 +168,7 @@ jobs:
needs: upload-coverage
runs-on: ubuntu-20.04
steps:
- uses: geekyeggo/delete-artifact@1-glob-support
- uses: geekyeggo/delete-artifact@v2
with:
name: cov-*
useGlob: true
+5 -9
View File
@@ -30,19 +30,15 @@ name: API Version
on: [pull_request]
jobs:
cancel-previous-runs:
runs-on: ubuntu-20.04
steps:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "github.ref != 'refs/heads/main'"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || (github.repository == 'openthread/openthread' && github.run_id) || github.ref }}
cancel-in-progress: true
jobs:
api-version:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- name: Check
+51 -16
View File
@@ -169,6 +169,7 @@ LOCAL_SRC_FILES := \
src/core/api/backbone_router_ftd_api.cpp \
src/core/api/border_agent_api.cpp \
src/core/api/border_router_api.cpp \
src/core/api/border_routing_api.cpp \
src/core/api/channel_manager_api.cpp \
src/core/api/channel_monitor_api.cpp \
src/core/api/child_supervision_api.cpp \
@@ -196,6 +197,7 @@ LOCAL_SRC_FILES := \
src/core/api/logging_api.cpp \
src/core/api/message_api.cpp \
src/core/api/multi_radio_api.cpp \
src/core/api/nat64_api.cpp \
src/core/api/netdata_api.cpp \
src/core/api/netdata_publisher_api.cpp \
src/core/api/netdiag_api.cpp \
@@ -210,6 +212,7 @@ LOCAL_SRC_FILES := \
src/core/api/srp_server_api.cpp \
src/core/api/tasklet_api.cpp \
src/core/api/tcp_api.cpp \
src/core/api/tcp_ext_api.cpp \
src/core/api/thread_api.cpp \
src/core/api/thread_ftd_api.cpp \
src/core/api/trel_api.cpp \
@@ -230,6 +233,8 @@ LOCAL_SRC_FILES := \
src/core/common/crc16.cpp \
src/core/common/data.cpp \
src/core/common/error.cpp \
src/core/common/frame_builder.cpp \
src/core/common/frame_data.cpp \
src/core/common/heap.cpp \
src/core/common/heap_data.cpp \
src/core/common/heap_string.cpp \
@@ -296,12 +301,13 @@ LOCAL_SRC_FILES := \
src/core/net/dns_types.cpp \
src/core/net/dnssd_server.cpp \
src/core/net/icmp6.cpp \
src/core/net/ip4_address.cpp \
src/core/net/ip4_types.cpp \
src/core/net/ip6.cpp \
src/core/net/ip6_address.cpp \
src/core/net/ip6_filter.cpp \
src/core/net/ip6_headers.cpp \
src/core/net/ip6_mpl.cpp \
src/core/net/nat64_translator.cpp \
src/core/net/nd6.cpp \
src/core/net/nd_agent.cpp \
src/core/net/netif.cpp \
@@ -310,6 +316,7 @@ LOCAL_SRC_FILES := \
src/core/net/srp_client.cpp \
src/core/net/srp_server.cpp \
src/core/net/tcp6.cpp \
src/core/net/tcp6_ext.cpp \
src/core/net/udp6.cpp \
src/core/radio/radio.cpp \
src/core/radio/radio_callbacks.cpp \
@@ -329,6 +336,7 @@ LOCAL_SRC_FILES := \
src/core/thread/indirect_sender.cpp \
src/core/thread/key_manager.cpp \
src/core/thread/link_metrics.cpp \
src/core/thread/link_metrics_types.cpp \
src/core/thread/link_quality.cpp \
src/core/thread/lowpan.cpp \
src/core/thread/mesh_forwarder.cpp \
@@ -397,6 +405,46 @@ LOCAL_SRC_FILES := \
src/posix/platform/trel.cpp \
src/posix/platform/udp.cpp \
src/posix/platform/utils.cpp \
third_party/tcplp/bsdtcp/tcp_usrreq.c \
third_party/tcplp/bsdtcp/tcp_subr.c \
third_party/tcplp/bsdtcp/tcp_output.c \
third_party/tcplp/bsdtcp/cc/cc_newreno.c \
third_party/tcplp/bsdtcp/tcp_reass.c \
third_party/tcplp/bsdtcp/tcp_timewait.c \
third_party/tcplp/bsdtcp/tcp_sack.c \
third_party/tcplp/bsdtcp/tcp_input.c \
third_party/tcplp/bsdtcp/tcp_timer.c \
third_party/tcplp/lib/bitmap.c \
third_party/tcplp/lib/cbuf.c \
third_party/tcplp/lib/lbuf.c \
$(OPENTHREAD_PROJECT_SRC_FILES) \
$(NULL)
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libopenthread-mbedtls
LOCAL_MODULE_TAGS := eng
LOCAL_C_INCLUDES := \
$(OPENTHREAD_PROJECT_INCLUDES) \
$(LOCAL_PATH)/include \
$(LOCAL_PATH)/src \
$(LOCAL_PATH)/src/cli \
$(LOCAL_PATH)/src/core \
$(LOCAL_PATH)/src/posix/platform \
$(LOCAL_PATH)/src/posix/platform/include \
$(LOCAL_PATH)/third_party/mbedtls \
$(LOCAL_PATH)/third_party/mbedtls/repo/include \
$(NULL)
LOCAL_CFLAGS := \
-std=c99 \
$(OPENTHREAD_PUBLIC_CFLAGS) \
$(OPENTHREAD_PRIVATE_CFLAGS) \
$(OPENTHREAD_PROJECT_CFLAGS) \
LOCAL_SRC_FILES := \
third_party/mbedtls/repo/library/aes.c \
third_party/mbedtls/repo/library/aesni.c \
third_party/mbedtls/repo/library/arc4.c \
@@ -484,20 +532,6 @@ LOCAL_SRC_FILES := \
third_party/mbedtls/repo/library/x509write_crt.c \
third_party/mbedtls/repo/library/x509write_csr.c \
third_party/mbedtls/repo/library/xtea.c \
third_party/tcplp/bsdtcp/tcp_usrreq.c \
third_party/tcplp/bsdtcp/tcp_subr.c \
third_party/tcplp/bsdtcp/tcp_output.c \
third_party/tcplp/bsdtcp/cc/cc_newreno.c \
third_party/tcplp/bsdtcp/tcp_reass.c \
third_party/tcplp/bsdtcp/tcp_timewait.c \
third_party/tcplp/bsdtcp/tcp_sack.c \
third_party/tcplp/bsdtcp/tcp_input.c \
third_party/tcplp/bsdtcp/tcp_timer.c \
third_party/tcplp/lib/bitmap.c \
third_party/tcplp/lib/cbuf.c \
third_party/tcplp/lib/lbuf.c \
$(OPENTHREAD_PROJECT_SRC_FILES) \
$(NULL)
include $(BUILD_STATIC_LIBRARY)
@@ -580,6 +614,7 @@ LOCAL_CPPFLAGS := \
$(NULL)
LOCAL_LDLIBS := \
-lanl \
-lrt \
-lutil
@@ -589,7 +624,7 @@ LOCAL_SRC_FILES := \
src/posix/main.c \
$(NULL)
LOCAL_STATIC_LIBRARIES = libopenthread-cli ot-core
LOCAL_STATIC_LIBRARIES = libopenthread-cli ot-core libopenthread-mbedtls
include $(BUILD_EXECUTABLE)
ifeq ($(USE_OTBR_DAEMON), 1)
+3
View File
@@ -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)
+4 -4
View File
@@ -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 Groups IP Policies, and not this license.
The included copyright to the OpenThread code is subject to the license in the
+2 -6
View File
@@ -10,7 +10,7 @@ OpenThread released by Google is... <a href="https://www.threadgroup.org/What-is
**...OS and platform agnostic**, with a narrow platform abstraction layer and a small memory footprint, making it highly portable. It supports both system-on-chip (SoC) and network co-processor (NCP) designs.
**...a Thread Certified Component**, implementing all features defined in the [Thread 1.2 specification](https://www.threadgroup.org/support#specifications), including all Thread networking layers (IPv6, 6LoWPAN, IEEE 802.15.4 with MAC security, Mesh Link Establishment, Mesh Routing) and device roles, as well as [Border Router](https://github.com/openthread/ot-br-posix) support.
**...a Thread Certified Component**, implementing all features defined in the [Thread 1.3.0 specification](https://www.threadgroup.org/support#specifications), including all Thread networking layers (IPv6, 6LoWPAN, IEEE 802.15.4 with MAC security, Mesh Link Establishment, Mesh Routing) and device roles, as well as [Border Router](https://github.com/openthread/ot-br-posix) support.
More information about Thread can be found at [threadgroup.org](http://threadgroup.org/). Thread is a registered trademark of the Thread Group, Inc.
@@ -29,7 +29,7 @@ More information about Thread can be found at [threadgroup.org](http://threadgro
# Who supports OpenThread?
<a href="https://www.arm.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-arm.png" alt="ARM" width="200px"></a><a href="https://www.cascoda.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-cascoda.png" alt="Cascoda" width="200px"></a><a href="https://www.espressif.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-espressif-github.png" alt="Espressif" width="200px"></a><a href="https://www.google.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-google.png" alt="Google" width="200px"></a><a href="https://www.infineon.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-infineon.png" alt="Infineon" width="200px"></a><a href="http://www.nordicsemi.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-nordic.png" alt="Nordic" width="200px"></a><a href="http://www.nxp.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-nxp.png" alt="NXP" width="200px"></a><a href="http://www.qorvo.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-qorvo.png" alt="Qorvo" width="200px"></a><a href="https://www.qualcomm.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-qc.png" alt="Qualcomm" width="200px"></a><a href="https://www.samsung.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-samsung.png" alt="Samsung" width="200px"></a><a href="https://www.silabs.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-silabs.png" alt="Silicon Labs" width="200px"></a><a href="https://www.st.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-stm.png" alt="STMicroelectronics" width="200px"></a><a href="https://www.synopsys.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-synopsys.png" alt="Synopsys" width="200px"></a><a href="https://www.telink-semi.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-telink-github.png" alt="Telink Semiconductor" width="200px"></a><a href="https://www.ti.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-ti.png" alt="Texas Instruments" width="200px"></a><a href="https://www.zephyrproject.org/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-zephyr.png" alt="Zephyr Project" width="200px"></a>
<a href="https://www.amazon.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-amazon.png" alt="Amazon" width="200px"></a><a href="https://www.arm.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-arm.png" alt="ARM" width="200px"></a><a href="https://www.cascoda.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-cascoda.png" alt="Cascoda" width="200px"></a><a href="https://www.eero.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-eero.png" alt="Eero" width="200px"></a><a href="https://www.espressif.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-espressif-github.png" alt="Espressif" width="200px"></a><a href="https://www.google.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-google.png" alt="Google" width="200px"></a><a href="https://www.infineon.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-infineon.png" alt="Infineon" width="200px"></a><a href="https://mmbnetworks.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-mmb-networks.png" alt="MMB Networks" width="200px"></a><a href="https://www.nanoleaf.me/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-nanoleaf.png" alt="Nanoleaf" width="200px"></a><a href="http://www.nordicsemi.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-nordic.png" alt="Nordic" width="200px"></a><a href="http://www.nxp.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-nxp.png" alt="NXP" width="200px"></a><a href="http://www.qorvo.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-qorvo.png" alt="Qorvo" width="200px"></a><a href="https://www.qualcomm.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-qc.png" alt="Qualcomm" width="200px"></a><a href="https://www.samsung.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-samsung.png" alt="Samsung" width="200px"></a><a href="https://www.silabs.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-silabs.png" alt="Silicon Labs" width="200px"></a><a href="https://www.st.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-stm.png" alt="STMicroelectronics" width="200px"></a><a href="https://www.synopsys.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-synopsys.png" alt="Synopsys" width="200px"></a><a href="https://www.telink-semi.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-telink-github.png" alt="Telink Semiconductor" width="200px"></a><a href="https://www.ti.com/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-ti.png" alt="Texas Instruments" width="200px"></a><a href="https://www.zephyrproject.org/"><img src="https://github.com/openthread/openthread/raw/main/doc/images/ot-contrib-zephyr.png" alt="Zephyr Project" width="200px"></a>
# Getting started
@@ -54,10 +54,6 @@ We would love for you to contribute to OpenThread and help make it even better t
Contributors are required to abide by our [Code of Conduct](https://github.com/openthread/openthread/blob/main/CODE_OF_CONDUCT.md) and [Coding Conventions and Style Guide](https://github.com/openthread/openthread/blob/main/STYLE_GUIDE.md).
# Versioning
OpenThread follows the [Semantic Versioning guidelines](http://semver.org/) for release cycle transparency and to maintain backwards compatibility. OpenThread's versioning is independent of the Thread protocol specification version but will clearly indicate which version of the specification it currently supports.
# License
OpenThread is released under the [BSD 3-Clause license](https://github.com/openthread/openthread/blob/main/LICENSE). See the [`LICENSE`](https://github.com/openthread/openthread/blob/main/LICENSE) file for more information.
+4 -3
View File
@@ -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
View File
@@ -804,14 +804,14 @@ AC_MSG_CHECKING([whether to build examples])
AC_ARG_WITH(examples,
[AS_HELP_STRING([--with-examples=TARGET],
[Build example applications for one of: simulation, cc2538 @<:@default=no@:>@.
[Build example applications for one of: simulation @<:@default=no@:>@.
Note that building example applications also builds the associated OpenThread platform libraries
and any third_party libraries needed to support the examples.])],
[
case "${with_examples}" in
no)
;;
simulation|cc2538)
simulation)
;;
*)
AC_MSG_RESULT(ERROR)
@@ -824,7 +824,6 @@ AC_ARG_WITH(examples,
AM_CONDITIONAL([OPENTHREAD_ENABLE_EXAMPLES], [test ${with_examples} != "no"])
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_SIMULATION],[test "${with_examples}" = "simulation"])
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_CC2538], [test "${with_examples}" = "cc2538"])
AM_COND_IF([OPENTHREAD_EXAMPLES_SIMULATION], CPPFLAGS="${CPPFLAGS} -DOPENTHREAD_EXAMPLES_SIMULATION=1", CPPFLAGS="${CPPFLAGS} -DOPENTHREAD_EXAMPLES_SIMULATION=0")
@@ -845,11 +844,11 @@ AC_MSG_CHECKING([whether to build platform libraries])
AC_ARG_WITH(platform,
[AS_HELP_STRING([--with-platform=TARGET],
[Build OpenThread platform libraries for one of: cc2538, posix, simulation @<:@default=simulation@:>@.])],
[Build OpenThread platform libraries for one of: posix, simulation @<:@default=simulation@:>@.])],
[
# Make sure the given target is valid.
case "${with_platform}" in
no|cc2538|posix|simulation)
no|posix|simulation)
;;
*)
AC_MSG_RESULT(ERROR)
@@ -880,7 +879,6 @@ AM_CONDITIONAL([OPENTHREAD_ENABLE_PLATFORM], [test ${with_platform} != "no"])
OPENTHREAD_ENABLE_PLATFORM=${with_platform}
AM_CONDITIONAL([OPENTHREAD_PLATFORM_CC2538], [test "${with_platform}" = "cc2538"])
AM_CONDITIONAL([OPENTHREAD_PLATFORM_POSIX], [test "${with_platform}" = "posix"])
AM_CONDITIONAL([OPENTHREAD_PLATFORM_SIMULATION],[test "${with_platform}" = "simulation"])
@@ -1023,7 +1021,6 @@ examples/apps/Makefile
examples/apps/cli/Makefile
examples/apps/ncp/Makefile
examples/platforms/Makefile
examples/platforms/cc2538/Makefile
examples/platforms/simulation/Makefile
examples/platforms/utils/Makefile
tools/Makefile
Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

+4
View File
@@ -57,6 +57,7 @@
* @defgroup api-dnssd-server DNS-SD Server
* @defgroup api-icmp6 ICMPv6
* @defgroup api-ip6 IPv6
* @defgroup api-nat64 NAT64
* @defgroup api-srp SRP
* @defgroup api-ping-sender Ping Sender
*
@@ -102,11 +103,13 @@
* @defgroup api-backbone-router Backbone Router
* @defgroup api-border-agent Border Agent
* @defgroup api-border-router Border Router
* @defgroup api-border-routing Border Routing Manager
* @defgroup api-commissioner Commissioner
* @defgroup api-thread-general General
* @brief This module includes functions for all Thread roles.
* @defgroup api-joiner Joiner
* @defgroup api-operational-dataset Operational Dataset
* @brief Includes functions for the Operational Dataset API.
* @defgroup api-thread-router Router/Leader
* @brief This module includes functions for Thread Routers and Leaders.
* @defgroup api-server Server
@@ -177,6 +180,7 @@
* @defgroup plat-time Time Service
* @defgroup plat-toolchain Toolchain
* @defgroup plat-trel TREL - Platform
* @defgroup plat-infra-if Infrastructure Interface
*
* @}
*
+124 -347
View File
@@ -34,58 +34,135 @@ option(OT_FTD "enable FTD" ON)
option(OT_MTD "enable MTD" ON)
option(OT_RCP "enable RCP" ON)
option(OT_ANYCAST_LOCATOR "enable anycast locator support")
if(OT_ANYCAST_LOCATOR)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_TMF_ANYCAST_LOCATOR_ENABLE=1")
set(OT_CONFIG_VALUES
""
"ON"
"OFF"
)
macro(ot_option name ot_config description)
# Declare an OT cmake config with `name` mapping to OPENTHREAD_CONFIG
# `ot_config`. Parameter `description` provides the help string for this
# OT cmake config. There is an optional last parameter which if provided
# determines the default value for the cmake config. If not provided
# empty string is used which will be treated as "not specified". In this
# case, the variable `name` would still be false but the related
# OPENTHREAD_CONFIG is not added in `ot-config`.
if (${ARGC} GREATER 3)
set(${name} ${ARGN} CACHE STRING "enable ${description}")
else()
set(${name} "" CACHE STRING "enable ${description}")
endif()
set_property(CACHE ${name} PROPERTY STRINGS ${OT_CONFIG_VALUES})
string(COMPARE EQUAL "${${name}}" "" is_empty)
if (is_empty)
message(STATUS "${name}=\"\"")
elseif (${name})
message(STATUS "${name}=ON --> ${ot_config}=1")
target_compile_definitions(ot-config INTERFACE "${ot_config}=1")
else()
message(STATUS "${name}=OFF --> ${ot_config}=0")
target_compile_definitions(ot-config INTERFACE "${ot_config}=0")
endif()
endmacro()
ot_option(OT_ANYCAST_LOCATOR OPENTHREAD_CONFIG_TMF_ANYCAST_LOCATOR_ENABLE "anycast locator")
ot_option(OT_ASSERT OPENTHREAD_CONFIG_ASSERT_ENABLE "assert function OT_ASSERT()")
ot_option(OT_BACKBONE_ROUTER OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE "backbone router functionality")
ot_option(OT_BACKBONE_ROUTER_DUA_NDPROXYING OPENTHREAD_CONFIG_BACKBONE_ROUTER_DUA_NDPROXYING_ENABLE "BBR DUA ND Proxy")
ot_option(OT_BACKBONE_ROUTER_MULTICAST_ROUTING OPENTHREAD_CONFIG_BACKBONE_ROUTER_MULTICAST_ROUTING_ENABLE "BBR MR")
ot_option(OT_BORDER_AGENT OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE "border agent")
ot_option(OT_BORDER_ROUTER OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE "border router")
ot_option(OT_BORDER_ROUTING OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE "border routing")
ot_option(OT_CHANNEL_MANAGER OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE "channel manager")
ot_option(OT_CHANNEL_MONITOR OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE "channel monitor")
ot_option(OT_CHILD_SUPERVISION OPENTHREAD_CONFIG_CHILD_SUPERVISION_ENABLE "child supervision")
ot_option(OT_COAP OPENTHREAD_CONFIG_COAP_API_ENABLE "coap api")
ot_option(OT_COAP_BLOCK OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE "coap block-wise transfer (RFC7959)")
ot_option(OT_COAP_OBSERVE OPENTHREAD_CONFIG_COAP_OBSERVE_API_ENABLE "coap observe (RFC7641)")
ot_option(OT_COAPS OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE "secure coap")
ot_option(OT_COMMISSIONER OPENTHREAD_CONFIG_COMMISSIONER_ENABLE "commissioner")
ot_option(OT_CSL_AUTO_SYNC OPENTHREAD_CONFIG_MAC_CSL_AUTO_SYNC_ENABLE "data polling based on csl")
ot_option(OT_CSL_DEBUG OPENTHREAD_CONFIG_MAC_CSL_DEBUG_ENABLE "csl debug")
ot_option(OT_CSL_RECEIVER OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE "csl receiver")
ot_option(OT_DATASET_UPDATER OPENTHREAD_CONFIG_DATASET_UPDATER_ENABLE "dataset updater")
ot_option(OT_DHCP6_CLIENT OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE "DHCP6 client")
ot_option(OT_DHCP6_SERVER OPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE "DHCP6 server")
ot_option(OT_DIAGNOSTIC OPENTHREAD_CONFIG_DIAG_ENABLE "diagnostic")
ot_option(OT_DNS_CLIENT OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE "DNS client")
ot_option(OT_DNS_DSO OPENTHREAD_CONFIG_DNS_DSO_ENABLE "DNS Stateful Operations (DSO)")
ot_option(OT_DNSSD_SERVER OPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE "DNS-SD server")
ot_option(OT_DUA OPENTHREAD_CONFIG_DUA_ENABLE "Domain Unicast Address (DUA)")
ot_option(OT_ECDSA OPENTHREAD_CONFIG_ECDSA_ENABLE "ECDSA")
ot_option(OT_EXTERNAL_HEAP OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE "external heap")
ot_option(OT_FIREWALL OPENTHREAD_POSIX_CONFIG_FIREWALL_ENABLE "firewall")
ot_option(OT_HISTORY_TRACKER OPENTHREAD_CONFIG_HISTORY_TRACKER_ENABLE "history tracker")
ot_option(OT_IP6_FRAGM OPENTHREAD_CONFIG_IP6_FRAGMENTATION_ENABLE "ipv6 fragmentation")
ot_option(OT_JAM_DETECTION OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE "jam detection")
ot_option(OT_JOINER OPENTHREAD_CONFIG_JOINER_ENABLE "joiner")
ot_option(OT_LEGACY OPENTHREAD_CONFIG_LEGACY_ENABLE "legacy network")
ot_option(OT_LINK_METRICS_INITIATOR OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE "link metrics initiator")
ot_option(OT_LINK_METRICS_SUBJECT OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE "link metrics subject")
ot_option(OT_LINK_RAW OPENTHREAD_CONFIG_LINK_RAW_ENABLE "link raw service")
ot_option(OT_LOG_LEVEL_DYNAMIC OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE "dynamic log level control")
ot_option(OT_MAC_FILTER OPENTHREAD_CONFIG_MAC_FILTER_ENABLE "mac filter")
ot_option(OT_MESSAGE_USE_HEAP OPENTHREAD_CONFIG_MESSAGE_USE_HEAP_ENABLE "heap allocator for message buffers")
ot_option(OT_MLE_LONG_ROUTES OPENTHREAD_CONFIG_MLE_LONG_ROUTES_ENABLE "MLE long routes extension (experimental)")
ot_option(OT_MLR OPENTHREAD_CONFIG_MLR_ENABLE "Multicast Listener Registration (MLR)")
ot_option(OT_MTD_NETDIAG OPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE "TMF network diagnostics on MTDs")
ot_option(OT_MULTIPLE_INSTANCE OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE "multiple instances")
ot_option(OT_NAT64_BORDER_ROUTING OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE "border routing NAT64")
ot_option(OT_NAT64_TRANSLATOR OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE "NAT64 translator support")
ot_option(OT_NEIGHBOR_DISCOVERY_AGENT OPENTHREAD_CONFIG_NEIGHBOR_DISCOVERY_AGENT_ENABLE "neighbor discovery agent")
ot_option(OT_NETDATA_PUBLISHER OPENTHREAD_CONFIG_NETDATA_PUBLISHER_ENABLE "Network Data publisher")
ot_option(OT_OTNS OPENTHREAD_CONFIG_OTNS_ENABLE "OTNS")
ot_option(OT_PING_SENDER OPENTHREAD_CONFIG_PING_SENDER_ENABLE "ping sender" ${OT_APP_CLI})
ot_option(OT_PLATFORM_NETIF OPENTHREAD_CONFIG_PLATFORM_NETIF_ENABLE "platform netif")
ot_option(OT_PLATFORM_UDP OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE "platform UDP")
ot_option(OT_REFERENCE_DEVICE OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE "test harness reference device")
ot_option(OT_SERVICE OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE "Network Data service")
ot_option(OT_SETTINGS_RAM OPENTHREAD_SETTINGS_RAM "volatile-only storage of settings")
ot_option(OT_SLAAC OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE "SLAAC address")
ot_option(OT_SNTP_CLIENT OPENTHREAD_CONFIG_SNTP_CLIENT_ENABLE "SNTP client")
ot_option(OT_SRP_CLIENT OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE "SRP client")
ot_option(OT_SRP_SERVER OPENTHREAD_CONFIG_SRP_SERVER_ENABLE "SRP server")
ot_option(OT_TIME_SYNC OPENTHREAD_CONFIG_TIME_SYNC_ENABLE "time synchronization service")
ot_option(OT_TREL OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE "TREL radio link for Thread over Infrastructure feature")
ot_option(OT_TX_BEACON_PAYLOAD OPENTHREAD_CONFIG_MAC_OUTGOING_BEACON_PAYLOAD_ENABLE "tx beacon payload")
ot_option(OT_UDP_FORWARD OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE "UDP forward")
ot_option(OT_UPTIME OPENTHREAD_CONFIG_UPTIME_ENABLE "uptime")
option(OT_DOC "Build OpenThread documentation")
option(OT_FULL_LOGS "enable full logs")
if(OT_FULL_LOGS)
if(NOT OT_LOG_LEVEL)
message(STATUS "OT_FULL_LOGS=ON --> Setting LOG_LEVEL to DEBG")
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_LEVEL=OT_LOG_LEVEL_DEBG")
endif()
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_PREPEND_LEVEL=1")
endif()
option(OT_ASSERT "enable assert function OT_ASSERT()" ON)
if(OT_ASSERT)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_ASSERT_ENABLE=1")
set(OT_MLE_MAX_CHILDREN "" CACHE STRING "set maximum number of children")
if(OT_MLE_MAX_CHILDREN MATCHES "^[0-9]+$")
message(STATUS "OT_MLE_MAX_CHILDREN=${OT_MLE_MAX_CHILDREN}")
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MLE_MAX_CHILDREN=${OT_MLE_MAX_CHILDREN}")
elseif(NOT OT_MLE_MAX_CHILDREN STREQUAL "")
message(FATAL_ERROR "Invalid maximum number of children: ${OT_MLE_MAX_CHILDREN}")
endif()
set(OT_RCP_RESTORATION_MAX_COUNT "0" CACHE STRING "set max RCP restoration count")
if(OT_RCP_RESTORATION_MAX_COUNT MATCHES "^[0-9]+$")
message(STATUS "OT_RCP_RESTORATION_MAX_COUNT=${OT_RCP_RESTORATION_MAX_COUNT}")
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT=${OT_RCP_RESTORATION_MAX_COUNT}")
else()
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_ASSERT_ENABLE=0")
message(FATAL_ERROR "Invalid max RCP restoration count: ${OT_RCP_RESTORATION_MAX_COUNT}")
endif()
option(OT_BACKBONE_ROUTER "enable backbone router functionality")
if(OT_BACKBONE_ROUTER)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE=1")
set(OT_BACKBONE_ROUTER_DUA_NDPROXYING ON CACHE BOOL "Enable DUA NDProxying by default")
set(OT_BACKBONE_ROUTER_MULTICAST_ROUTING ON CACHE BOOL "Enable Multicast Routing by default")
endif()
option(OT_BACKBONE_ROUTER_DUA_NDPROXYING "enable Backbone Router DUA ND Proxying functionality" OFF)
if(OT_BACKBONE_ROUTER_DUA_NDPROXYING)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_BACKBONE_ROUTER_DUA_NDPROXYING_ENABLE=1")
else()
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_BACKBONE_ROUTER_DUA_NDPROXYING_ENABLE=0")
endif()
option(OT_BACKBONE_ROUTER_MULTICAST_ROUTING "enable Backbone Router Multicast Routing functionality" OFF)
if(OT_BACKBONE_ROUTER_MULTICAST_ROUTING)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_BACKBONE_ROUTER_MULTICAST_ROUTING_ENABLE=1")
else()
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_BACKBONE_ROUTER_MULTICAST_ROUTING_ENABLE=0")
endif()
option(OT_BORDER_AGENT "enable border agent support")
if(OT_BORDER_AGENT)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE=1")
endif()
option(OT_BORDER_ROUTER "enable border router support")
if(OT_BORDER_ROUTER)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE=1")
endif()
option(OT_BORDER_ROUTING "enable border routing support")
if(OT_BORDER_ROUTING)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE=1")
endif()
option(OT_BORDER_ROUTING_NAT64 "enable border routing NAT64 support")
if(OT_BORDER_ROUTING_NAT64)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_BORDER_ROUTING_NAT64_ENABLE=1")
endif()
option(OT_EXCLUDE_TCPLP_LIB "exclude TCPlp library from build")
if(NOT OT_EXTERNAL_MBEDTLS)
set(OT_MBEDTLS mbedtls)
@@ -102,307 +179,7 @@ else()
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS_MANAGEMENT=0")
endif()
option(OT_CHANNEL_MANAGER "enable channel manager support")
if(OT_CHANNEL_MANAGER)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE=1")
endif()
option(OT_CHANNEL_MONITOR "enable channel monitor support")
if(OT_CHANNEL_MONITOR)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE=1")
endif()
option(OT_CHILD_SUPERVISION "enable child supervision support")
if(OT_CHILD_SUPERVISION)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_CHILD_SUPERVISION_ENABLE=1")
endif()
option(OT_COAP "enable coap api support")
if(OT_COAP)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_COAP_API_ENABLE=1")
endif()
option(OT_COAPS "enable secure coap api support")
if(OT_COAPS)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE=1")
endif()
option(OT_COAP_BLOCK "enable coap block-wise transfer (RFC7959) api support")
if(OT_COAP_BLOCK)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE=1")
endif()
option(OT_COAP_OBSERVE "enable coap observe (RFC7641) api support")
if(OT_COAP_OBSERVE)
list(APPEND OT_PRIVATE_DEFINES "OPENTHREAD_CONFIG_COAP_OBSERVE_API_ENABLE=1")
endif()
option(OT_COMMISSIONER "enable commissioner support")
if(OT_COMMISSIONER)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_COMMISSIONER_ENABLE=1")
endif()
option(OT_CSL_RECEIVER "enable csl receiver")
if(OT_CSL_RECEIVER)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE=1")
endif()
option(OT_CSL_AUTO_SYNC "enable data polling based on csl config" ${OT_CSL_RECEIVER})
if(OT_CSL_AUTO_SYNC)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MAC_CSL_AUTO_SYNC_ENABLE=1")
else()
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MAC_CSL_AUTO_SYNC_ENABLE=0")
endif()
option(OT_CSL_DEBUG "enable csl debug")
if(OT_CSL_DEBUG)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MAC_CSL_DEBUG_ENABLE=1")
endif()
option(OT_DATASET_UPDATER "enable dataset updater support")
if(OT_DATASET_UPDATER)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_DATASET_UPDATER_ENABLE=1")
endif()
option(OT_DHCP6_CLIENT "enable DHCP6 client support")
if(OT_DHCP6_CLIENT)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE=1")
endif()
option(OT_DHCP6_SERVER "enable DHCP6 server support")
if(OT_DHCP6_SERVER)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE=1")
endif()
option(OT_DIAGNOSTIC "enable diagnostic support")
if(OT_DIAGNOSTIC)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_DIAG_ENABLE=1")
endif()
option(OT_DNS_CLIENT "enable DNS client support")
if(OT_DNS_CLIENT)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE=1")
endif()
option(OT_DNS_DSO "enable DNS Stateful Operations (DSO) support")
if(OT_DNS_DSO)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_DNS_DSO_ENABLE=1")
endif()
option(OT_DNSSD_SERVER "enable DNS-SD server support")
if(OT_DNSSD_SERVER)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE=1")
endif()
option(OT_DOC "Build OpenThread documentation")
option(OT_ECDSA "enable ECDSA support")
if(OT_ECDSA)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_ECDSA_ENABLE=1")
endif()
option(OT_SRP_CLIENT "enable SRP client support")
if (OT_SRP_CLIENT)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE=1")
endif()
option(OT_DUA "enable Domain Unicast Address feature for Thread 1.2")
if(OT_DUA)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_DUA_ENABLE=1")
endif()
option(OT_MESSAGE_USE_HEAP "enable heap allocator for message buffers")
if(OT_MESSAGE_USE_HEAP)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MESSAGE_USE_HEAP_ENABLE=1")
endif()
option(OT_MLR "enable Multicast Listener Registration feature for Thread 1.2")
if(OT_MLR)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MLR_ENABLE=1")
endif()
option(OT_EXTERNAL_HEAP "enable external heap support")
if(OT_EXTERNAL_HEAP)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE=1")
endif()
option(OT_HISTORY_TRACKER "enable history tracker support")
if(OT_HISTORY_TRACKER)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_HISTORY_TRACKER_ENABLE=1")
endif()
option(OT_IP6_FRAGM "enable ipv6 fragmentation support")
if(OT_IP6_FRAGM)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_IP6_FRAGMENTATION_ENABLE=1")
endif()
option(OT_JAM_DETECTION "enable jam detection support")
if(OT_JAM_DETECTION)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE=1")
endif()
option(OT_JOINER "enable joiner support")
if(OT_JOINER)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_JOINER_ENABLE=1")
endif()
option(OT_LEGACY "enable legacy network support")
if(OT_LEGACY)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LEGACY_ENABLE=1")
endif()
option(OT_LINK_RAW "enable link raw service")
if(OT_LINK_RAW)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LINK_RAW_ENABLE=1")
endif()
option(OT_LINK_METRICS_INITIATOR "enable link metrics initiator")
if (OT_LINK_METRICS_INITIATOR)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE=1")
endif()
option(OT_LINK_METRICS_SUBJECT "enable link metrics subject")
if (OT_LINK_METRICS_SUBJECT)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE=1")
endif()
option(OT_LOG_LEVEL_DYNAMIC "enable dynamic log level control")
if(OT_LOG_LEVEL_DYNAMIC)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE=1")
endif()
option(OT_MAC_FILTER "enable mac filter support")
if(OT_MAC_FILTER)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MAC_FILTER_ENABLE=1")
endif()
option(OT_MLE_LONG_ROUTES "enable MLE long routes extension (experimental, breaks Thread conformance)")
if(OT_MLE_LONG_ROUTES)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MLE_LONG_ROUTES_ENABLE=1")
endif()
option(OT_MTD_NETDIAG "enable TMF network diagnostics on MTDs")
if(OT_MTD_NETDIAG)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE=1")
endif()
option(OT_MULTIPLE_INSTANCE "enable multiple instances")
if(OT_MULTIPLE_INSTANCE)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE=1")
endif()
option(OT_NEIGHBOR_DISCOVERY_AGENT "enable neighbor discovery agent support")
if(OT_NEIGHBOR_DISCOVERY_AGENT)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_NEIGHBOR_DISCOVERY_AGENT_ENABLE=1")
endif()
option(OT_NETDATA_PUBLISHER "enable Thread Network Data publisher")
if(OT_NETDATA_PUBLISHER)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_NETDATA_PUBLISHER_ENABLE=1")
endif()
option(OT_PING_SENDER "enable ping sender support" ${OT_APP_CLI})
if(OT_PING_SENDER)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_PING_SENDER_ENABLE=1")
endif()
option(OT_PLATFORM_NETIF "enable platform netif support")
if(OT_PLATFORM_NETIF)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_PLATFORM_NETIF_ENABLE=1")
endif()
option(OT_PLATFORM_UDP "enable platform UDP support")
if(OT_PLATFORM_UDP)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE=1")
endif()
if(OT_POSIX_SETTINGS_PATH)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_POSIX_SETTINGS_PATH=${OT_POSIX_SETTINGS_PATH}")
endif()
option(OT_REFERENCE_DEVICE "enable Thread Test Harness reference device support")
if(OT_REFERENCE_DEVICE)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE=1")
endif()
option(OT_SERVICE "enable support for injecting Service entries into the Thread Network Data")
if(OT_SERVICE)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE=1")
endif()
option(OT_SETTINGS_RAM "enable volatile-only storage of settings")
if(OT_SETTINGS_RAM)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_SETTINGS_RAM=1")
endif()
option(OT_SLAAC "enable support for adding of auto-configured SLAAC addresses by OpenThread")
if(OT_SLAAC)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE=1")
endif()
option(OT_SNTP_CLIENT "enable SNTP Client support")
if(OT_SNTP_CLIENT)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_SNTP_CLIENT_ENABLE=1")
endif()
option(OT_SRP_SERVER "enable SRP server")
if (OT_SRP_SERVER)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_SRP_SERVER_ENABLE=1")
endif()
option(OT_TIME_SYNC "enable the time synchronization service feature")
if(OT_TIME_SYNC)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_TIME_SYNC_ENABLE=1")
endif()
option(OT_TREL "enable TREL radio link for Thread over Infrastructure feature")
if (OT_TREL)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE=1")
endif()
option(OT_TX_BEACON_PAYLOAD "enable Thread beacon payload in outgoing beacons")
if (OT_TX_BEACON_PAYLOAD)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MAC_OUTGOING_BEACON_PAYLOAD_ENABLE=1")
endif()
option(OT_UDP_FORWARD "enable UDP forward support")
if(OT_UDP_FORWARD)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE=1")
endif()
option(OT_UPTIME "enable support for tracking OpenThread instance's uptime")
if(OT_UPTIME)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_UPTIME_ENABLE=1")
endif()
option(OT_FIREWALL "enable firewall")
if (OT_FIREWALL)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_POSIX_CONFIG_FIREWALL_ENABLE=1")
endif()
option(OT_FULL_LOGS "enable full logs")
if(OT_FULL_LOGS)
if(NOT OT_LOG_LEVEL)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_LEVEL=OT_LOG_LEVEL_DEBG")
endif()
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_PREPEND_LEVEL=1")
endif()
option(OT_OTNS "enable OTNS support")
if(OT_OTNS)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_OTNS_ENABLE=1")
endif()
set(OT_RCP_RESTORATION_MAX_COUNT "0" CACHE STRING "set max RCP restoration count")
if(OT_RCP_RESTORATION_MAX_COUNT MATCHES "^[0-9]+$")
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT=${OT_RCP_RESTORATION_MAX_COUNT}")
else()
message(FATAL_ERROR "Invalid max RCP restoration count: ${OT_RCP_RESTORATION_MAX_COUNT}")
endif()
option(OT_EXCLUDE_TCPLP_LIB "exclude TCPlp library from build")
# Checks
if(OT_PLATFORM_UDP AND OT_UDP_FORWARD)
message(FATAL_ERROR "OT_PLATFORM_UDP and OT_UDP_FORWARD are exclusive")
endif()
+1
View File
@@ -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
-309
View File
@@ -1,309 +0,0 @@
#
# Copyright (c) 2016, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
.NOTPARALLEL:
AR = arm-none-eabi-ar
CCAS = arm-none-eabi-as
CPP = arm-none-eabi-cpp
CC = arm-none-eabi-gcc
CXX = arm-none-eabi-g++
LD = arm-none-eabi-ld
STRIP = arm-none-eabi-strip
NM = arm-none-eabi-nm
RANLIB = arm-none-eabi-ranlib
OBJCOPY = arm-none-eabi-objcopy
BuildJobs ?= 10
configure_OPTIONS = \
--enable-cli \
--enable-ftd \
--enable-mtd \
--enable-ncp \
--enable-radio-only \
--enable-linker-map \
--with-examples=cc2538 \
$(NULL)
TopSourceDir := $(dir $(shell readlink $(firstword $(MAKEFILE_LIST))))..
AbsTopSourceDir := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))..
CC2538_CONFIG_FILE_CPPFLAGS = -DOPENTHREAD_PROJECT_CORE_CONFIG_FILE='\"openthread-core-cc2538-config.h\"'
CC2538_CONFIG_FILE_CPPFLAGS += -DOPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE='\"openthread-core-cc2538-config-check.h\"'
CC2538_CONFIG_FILE_CPPFLAGS += -I$(AbsTopSourceDir)/examples/platforms/cc2538/
COMMONCFLAGS := \
-fdata-sections \
-ffunction-sections \
-Os \
-g \
$(CC2538_CONFIG_FILE_CPPFLAGS) \
$(NULL)
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/common-switches.mk
# Optional CC2592 options, first and foremost, whether to enable support for it
# at all.
ifeq ($(CC2592),1)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_CC2538_WITH_CC2592=1
# If the PA_EN is on another port C pin, specify it with CC2592_PA_PIN.
ifneq ($(CC2592_PA_EN),)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_CC2592_PA_EN_PIN=$(CC2592_PA_EN)
endif
# If the LNA_EN is on another port C pin, specify it with CC2592_LNA_PIN.
ifneq ($(CC2592_LNA_EN),)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_CC2592_LNA_EN_PIN=$(CC2592_LNA_EN)
endif
# If we're not using HGM, set CC2538_USE_HGM to 0.
ifeq ($(CC2592_USE_HGM),0)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_CC2592_USE_HGM=0
else # CC2592_USE_HGM=1
# HGM in use, if not on port D, specify the port here (A, B or C) with CC2592_HGM_PORT.
ifneq ($(CC2592_HGM_PORT),)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_CC2592_HGM_PORT=GPIO_$(CC2592_HGM_PORT)_BASE
endif
# If HGM is not at pin 2, specify which pin here with CC2592_HGM_PIN.
ifneq ($(CC2592_HGM_PIN),)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_CC2592_HGM_PIN=$(CC2592_HGM_PIN)
endif
# If we want it off by default, specify CC2592_HGM_DEFAULT_STATE=0
ifeq ($(CC2592_HGM_DEFAULT_STATE),0)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_CC2592_HGM_DEFAULT_STATE=false
endif
endif # CC2592_USE_HGM
endif # CC2592
ifneq ($(CC2538_RECEIVE_SENSITIVITY),)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_CC2538_RECEIVE_SENSITIVITY=$(CC2538_RECEIVE_SENSITIVITY)
endif
ifneq ($(CC2538_RSSI_OFFSET),)
COMMONCFLAGS += -DOPENTHREAD_CONFIG_CC2538_RSSI_OFFSET=$(CC2538_RSSI_OFFSET)
endif
CPPFLAGS += \
$(COMMONCFLAGS) \
$(target_CPPFLAGS) \
$(NULL)
CFLAGS += \
$(COMMONCFLAGS) \
$(target_CFLAGS) \
$(NULL)
CXXFLAGS += \
$(COMMONCFLAGS) \
$(target_CXXFLAGS) \
-fno-exceptions \
-fno-rtti \
$(NULL)
LDFLAGS += \
$(COMMONCFLAGS) \
$(target_LDFLAGS) \
-nostartfiles \
-specs=nano.specs \
-specs=nosys.specs \
-Wl,--gc-sections \
$(NULL)
ECHO := @echo
MAKE := make
MKDIR_P := mkdir -p
LN_S := ln -s
RM_F := rm -f
INSTALL := /usr/bin/install
INSTALLFLAGS := -p
BuildPath = build
TopBuildDir = $(BuildPath)
AbsTopBuildDir = $(PWD)/$(TopBuildDir)
ResultPath = output
TopResultDir = $(ResultPath)
AbsTopResultDir = $(PWD)/$(TopResultDir)
TargetTuple = cc2538
ARCHS = cortex-m3
TopTargetLibDir = $(TopResultDir)/$(TargetTuple)/lib
ifndef BuildJobs
BuildJobs := $(shell getconf _NPROCESSORS_ONLN)
endif
JOBSFLAG := -j$(BuildJobs)
#
# configure-arch <arch>
#
# Configure OpenThread for the specified architecture.
#
# arch - The architecture to configure.
#
define configure-arch
$(ECHO) " CONFIG $(TargetTuple)..."
(cd $(BuildPath)/$(TargetTuple) && $(AbsTopSourceDir)/configure \
INSTALL="$(INSTALL) $(INSTALLFLAGS)" \
CPP="$(CPP)" CC="$(CC)" CXX="$(CXX)" OBJC="$(OBJC)" OBJCXX="$(OBJCXX)" AR="$(AR)" RANLIB="$(RANLIB)" NM="$(NM)" STRIP="$(STRIP)" CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" \
--host=arm-none-eabi \
--prefix=/ \
--exec-prefix=/$(TargetTuple) \
$(configure_OPTIONS))
endef # configure-arch
#
# build-arch <arch>
#
# Build the OpenThread intermediate build products for the specified
# architecture.
#
# arch - The architecture to build.
#
define build-arch
$(ECHO) " BUILD $(TargetTuple)"
$(MAKE) $(JOBSFLAG) -C $(BuildPath)/$(TargetTuple) --no-print-directory \
all
endef # build-arch
#
# stage-arch <arch>
#
# Stage (install) the OpenThread final build products for the specified
# architecture.
#
# arch - The architecture to stage.
#
define stage-arch
$(ECHO) " STAGE $(TargetTuple)"
$(MAKE) $(JOBSFLAG) -C $(BuildPath)/$(TargetTuple) --no-print-directory \
DESTDIR=$(AbsTopResultDir) \
install
endef # stage-arch
#
# ARCH_template <arch>
#
# Define macros, targets and rules to configure, build, and stage the
# OpenThread for a single architecture.
#
# arch - The architecture to instantiate the template for.
#
define ARCH_template
CONFIGURE_TARGETS += configure-$(1)
BUILD_TARGETS += do-build-$(1)
STAGE_TARGETS += stage-$(1)
BUILD_DIRS += $(BuildPath)/$(TargetTuple)
DIRECTORIES += $(BuildPath)/$(TargetTuple)
configure-$(1): target_CPPFLAGS=$($(1)_target_CPPFLAGS)
configure-$(1): target_CFLAGS=$($(1)_target_CFLAGS)
configure-$(1): target_CXXFLAGS=$($(1)_target_CXXFLAGS)
configure-$(1): target_LDFLAGS=$($(1)_target_LDFLAGS)
configure-$(1): $(BuildPath)/$(TargetTuple)/config.status
$(BuildPath)/$(TargetTuple)/config.status: | $(BuildPath)/$(TargetTuple)
$$(call configure-arch,$(1))
do-build-$(1): configure-$(1)
do-build-$(1):
+$$(call build-arch,$(1))
stage-$(1): do-build-$(1)
stage-$(1): | $(TopResultDir)
$$(call stage-arch,$(1))
$(1): stage-$(1)
endef # ARCH_template
.DEFAULT_GOAL := all
all: stage
#
# cortex-m3
#
cortex-m3_target_ABI = cortex-m3
cortex-m3_target_CPPFLAGS = -mcpu=cortex-m3 -mfloat-abi=soft -mthumb
cortex-m3_target_CFLAGS = -mcpu=cortex-m3 -mfloat-abi=soft -mthumb
cortex-m3_target_CXXFLAGS = -mcpu=cortex-m3 -mfloat-abi=soft -mthumb
cortex-m3_target_LDFLAGS = -mcpu=cortex-m3 -mfloat-abi=soft -mthumb
# Instantiate an architecture-specific build template for each target
# architecture.
$(foreach arch,$(ARCHS),$(eval $(call ARCH_template,$(arch))))
#
# Common / Finalization
#
configure: $(CONFIGURE_TARGETS)
build: $(BUILD_TARGETS)
stage: $(STAGE_TARGETS)
DIRECTORIES = $(TopResultDir) $(TopResultDir)/$(TargetTuple)/lib $(BUILD_DIRS)
CLEAN_DIRS = $(TopResultDir) $(BUILD_DIRS)
all: stage
$(DIRECTORIES):
$(ECHO) " MKDIR $@"
@$(MKDIR_P) "$@"
clean:
$(ECHO) " CLEAN"
@$(RM_F) -r $(CLEAN_DIRS)
help:
$(ECHO) "Simply type 'make -f $(firstword $(MAKEFILE_LIST))' to build OpenThread for the following "
$(ECHO) "architectures: "
$(ECHO) ""
$(ECHO) " $(ARCHS)"
$(ECHO) ""
$(ECHO) "To build only a particular architecture, specify: "
$(ECHO) ""
$(ECHO) " make -f $(firstword $(MAKEFILE_LIST)) <architecture>"
$(ECHO) ""
+4 -3
View File
@@ -12,7 +12,6 @@ This page lists the available common switches with description. Unless stated ot
| BORDER_AGENT | OT_BORDER_AGENT | Enables support for border agent. In most cases, enable this switch if you are building On-mesh Commissioner or Border Router with External Commissioning support. |
| BORDER_ROUTER | OT_BORDER_ROUTER | Enables support for Border Router. This switch is usually combined with the BORDER_AGENT and UDP_FORWARD (or PLATFORM_UDP in case of RCP design) switches to build Border Router device. |
| BORDER_ROUTING | OT_BORDER_ROUTING | Enables bi-directional border routing between Thread and Infrastructure networks for Border Router. |
| BORDER_ROUTING_NAT64 | OT_BORDER_ROUTING_NAT64 | Enables NAT64 border routing support for Border Router. |
| BUILTIN_MBEDTLS_MANAGEMENT | OT_BUILTIN_MBEDTLS_MANAGEMENT | Enables the built-in mbedTLS management. Enable this switch if the external mbedTLS is used, but mbedTLS memory allocation and debug config should be managed internally by OpenThread. |
| CHANNEL_MANAGER | OT_CHANNEL_MANAGER | Enables support for channel manager. Enable this switch on devices that are supposed to request a Thread network channel change. This switch should be used only with an FTD build. |
| CHANNEL_MONITOR | OT_CHANNEL_MONITOR | Enables support for channel monitor. Enable this switch on devices that are supposed to determine the cleaner channels. |
@@ -54,6 +53,8 @@ This page lists the available common switches with description. Unless stated ot
| MLR | OT_MLR | Enables Multicast Listener Registration feature for Thread 1.2. |
| MTD_NETDIAG | OT_MTD_NETDIAG | Enables the TMF network diagnostics on MTDs. |
| MULTIPLE_INSTANCE | OT_MULTIPLE_INSTANCE | Enables multiple OpenThread instances. |
| NAT64_BORDER_ROUTING | OT_NAT64_BORDER_ROUTING | Enables NAT64 border routing support for Border Router. |
| NAT64_TRANSLATOR | OT_NAT64_TRANSLATOR | Enables NAT64 translator for Border Router. |
| NETDATA_PUBLISHER | OT_NETDATA_PUBLISHER | Enables support for Thread Network Data publisher. |
| PING_SENDER | OT_PING_SENDER | Enables support for ping sender. |
| OTNS | OT_OTNS | Enables support for [OpenThread Network Simulator](https://github.com/openthread/ot-ns). Enable this switch if you are building OpenThread for OpenThread Network Simulator. |
@@ -67,7 +68,7 @@ This page lists the available common switches with description. Unless stated ot
| SRP_CLIENT | OT_SRP_CLIENT | Enable support for SRP client. |
| SRP_SERVER | OT_SRP_SERVER | Enable support for SRP server. |
| THREAD_VERSION | OT_THREAD_VERSION | Enables the chosen Thread version (1.1 / 1.2 (default)). For example, set to `1.1` for Thread 1.1. |
| TIME_SYNC | OT_TIME_SYNC | Enables the time synchronization service feature. **Note: Enabling this feature breaks conformance to the Thread Specification.** | |
| TIME_SYNC | OT_TIME_SYNC | Enables the time synchronization service feature. **Note: Enabling this feature breaks conformance to the Thread Specification.** |
| TREL | OT_TREL | Enables TREL radio link for Thread over Infrastructure feature. |
| UDP_FORWARD | OT_UDP_FORWARD | Enables support for UDP forward. | Enable this switch on the Border Router device (running on the NCP design) with External Commissioning support to service Thread Commissioner packets on the NCP side. |
| UDP_FORWARD | OT_UDP_FORWARD | Enables support for UDP forward. Enable this switch on the Border Router device (running on the NCP design) with External Commissioning support to service Thread Commissioner packets on the NCP side. |
| UPTIME | OT_UPTIME | Enables support for tracking OpenThread instance's uptime. |
+1
View File
@@ -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
)
+20 -4
View File
@@ -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;
+1
View File
@@ -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
)
+1
View File
@@ -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
)
+1
View File
@@ -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
)
+2 -2
View File
@@ -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);
}
+1
View File
@@ -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
)
+1
View File
@@ -43,6 +43,7 @@ target_link_libraries(ot-rcp PRIVATE
openthread-radio
${OT_PLATFORM_LIB_RCP}
openthread-rcp
ot-config-radio
ot-config
)
+8 -3
View File
@@ -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)
+1 -5
View File
@@ -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
-4
View File
@@ -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
-79
View File
@@ -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
)
-69
View File
@@ -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
View File
@@ -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
-148
View File
@@ -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")
-326
View File
@@ -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
-138
View File
@@ -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
}
-80
View File
@@ -1,80 +0,0 @@
/*
* Copyright (c) 2016, The OpenThread Authors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <sys/time.h>
#include <openthread/config.h>
#include <openthread/platform/alarm-milli.h>
#include <openthread/platform/radio.h>
#include "platform-cc2538.h"
#if OPENTHREAD_CONFIG_DIAG_ENABLE
/**
* Diagnostics mode variables.
*
*/
static bool sDiagMode = false;
void otPlatDiagModeSet(bool aMode)
{
sDiagMode = aMode;
}
bool otPlatDiagModeGet()
{
return sDiagMode;
}
void otPlatDiagChannelSet(uint8_t aChannel)
{
OT_UNUSED_VARIABLE(aChannel);
}
void otPlatDiagTxPowerSet(int8_t aTxPower)
{
OT_UNUSED_VARIABLE(aTxPower);
}
void otPlatDiagRadioReceived(otInstance *aInstance, otRadioFrame *aFrame, otError aError)
{
OT_UNUSED_VARIABLE(aInstance);
OT_UNUSED_VARIABLE(aFrame);
OT_UNUSED_VARIABLE(aError);
}
void otPlatDiagAlarmCallback(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
}
#endif // OPENTHREAD_CONFIG_DIAG_ENABLE
-112
View File
@@ -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;
}
-101
View File
@@ -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);
}
-49
View File
@@ -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_
-122
View File
@@ -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
-76
View File
@@ -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_
-215
View File
@@ -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)
;
}
-318
View File
@@ -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
+7
View File
@@ -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
/**
+129 -22
View File
@@ -71,10 +71,12 @@ enum
#if OPENTHREAD_SIMULATION_VIRTUAL_TIME
extern int sSockFd;
extern uint16_t sPortBase;
extern uint16_t sPortOffset;
#else
static int sTxFd = -1;
static int sRxFd = -1;
static uint16_t sPortBase = 9000;
static uint16_t sPortOffset = 0;
static uint16_t sPort = 0;
#endif
@@ -164,8 +166,84 @@ static otMacKeyMaterial sCurrKey;
static otMacKeyMaterial sNextKey;
static otRadioKeyType sKeyType;
enum
{
SIM_GPIO = 0,
};
static bool sGpioValue = false;
static int8_t GetRssi(uint16_t aChannel);
#if OPENTHREAD_SIMULATION_VIRTUAL_TIME == 0
static uint8_t sDeniedNodeIdsBitVector[(MAX_NETWORK_SIZE + 7) / 8];
static bool NodeIdFilterIsConnectable(uint16_t aNodeId)
{
uint16_t index = aNodeId - 1;
return (sDeniedNodeIdsBitVector[index / 8] & (0x80 >> (index % 8))) == 0;
}
static void NodeIdFilterDeny(uint16_t aNodeId)
{
uint16_t index = aNodeId - 1;
sDeniedNodeIdsBitVector[index / 8] |= 0x80 >> (index % 8);
}
static void NodeIdFilterClear(void)
{
memset(sDeniedNodeIdsBitVector, 0, sizeof(sDeniedNodeIdsBitVector));
}
otError ProcessNodeIdFilter(void *aContext, uint8_t aArgsLength, char *aArgs[])
{
OT_UNUSED_VARIABLE(aContext);
otError error = OT_ERROR_NONE;
otEXPECT_ACTION(aArgsLength > 0, error = OT_ERROR_INVALID_COMMAND);
if (!strcmp(aArgs[0], "clear"))
{
otEXPECT_ACTION(aArgsLength == 1, error = OT_ERROR_INVALID_ARGS);
NodeIdFilterClear();
}
else if (!strcmp(aArgs[0], "deny"))
{
uint16_t nodeId;
char * endptr;
otEXPECT_ACTION(aArgsLength == 2, error = OT_ERROR_INVALID_ARGS);
nodeId = (uint16_t)strtol(aArgs[1], &endptr, 0);
otEXPECT_ACTION(*endptr == '\0', error = OT_ERROR_INVALID_ARGS);
otEXPECT_ACTION(1 <= nodeId && nodeId <= MAX_NETWORK_SIZE, error = OT_ERROR_INVALID_ARGS);
NodeIdFilterDeny(nodeId);
}
else
{
error = OT_ERROR_INVALID_COMMAND;
}
exit:
return error;
}
#else
otError ProcessNodeIdFilter(void *aContext, uint8_t aArgsLength, char *aArgs[])
{
OT_UNUSED_VARIABLE(aContext);
OT_UNUSED_VARIABLE(aArgsLength);
OT_UNUSED_VARIABLE(aArgs);
return OT_ERROR_NOT_IMPLEMENTED;
}
#endif // OPENTHREAD_SIMULATION_VIRTUAL_TIME == 0
static bool IsTimeAfterOrEqual(uint32_t aTimeA, uint32_t aTimeB)
{
return (aTimeA - aTimeB) < (1U << 31);
@@ -298,7 +376,7 @@ static void initFds(void)
otEXPECT_ACTION((fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) != -1, perror("socket(sTxFd)"));
sPort = (uint16_t)(9000 + sPortOffset + gNodeId);
sPort = (uint16_t)(sPortBase + sPortOffset + gNodeId);
sockaddr.sin_family = AF_INET;
sockaddr.sin_port = htons(sPort);
sockaddr.sin_addr.s_addr = inet_addr("127.0.0.1");
@@ -337,7 +415,7 @@ static void initFds(void)
}
sockaddr.sin_family = AF_INET;
sockaddr.sin_port = htons((uint16_t)(9000 + sPortOffset));
sockaddr.sin_port = htons((uint16_t)(sPortBase + sPortOffset));
sockaddr.sin_addr.s_addr = inet_addr(OT_RADIO_GROUP);
otEXPECT_ACTION(bind(fd, (struct sockaddr *)&sockaddr, sizeof(sockaddr)) != -1, perror("bind(sRxFd)"));
@@ -356,24 +434,10 @@ exit:
void platformRadioInit(void)
{
#if OPENTHREAD_SIMULATION_VIRTUAL_TIME == 0
char *offset;
parseFromEnvAsUint16("PORT_BASE", &sPortBase);
offset = getenv("PORT_OFFSET");
if (offset)
{
char *endptr;
sPortOffset = (uint16_t)strtol(offset, &endptr, 0);
if (*endptr != '\0')
{
fprintf(stderr, "Invalid PORT_OFFSET: %s\n", offset);
exit(EXIT_FAILURE);
}
sPortOffset *= (MAX_NETWORK_SIZE + 1);
}
parseFromEnvAsUint16("PORT_OFFSET", &sPortOffset);
sPortOffset *= (MAX_NETWORK_SIZE + 1);
initFds();
#endif // OPENTHREAD_SIMULATION_VIRTUAL_TIME == 0
@@ -829,7 +893,10 @@ void platformRadioProcess(otInstance *aInstance, const fd_set *aReadFdSet, const
if (rval > 0)
{
if (sockaddr.sin_port != htons(sPort))
uint16_t srcPort = ntohs(sockaddr.sin_port);
uint16_t srcNodeId = srcPort - sPortOffset - sPortBase;
if (NodeIdFilterIsConnectable(srcNodeId) && srcPort != sPort)
{
sReceiveFrame.mLength = (uint16_t)(rval - 1);
@@ -847,7 +914,7 @@ void platformRadioProcess(otInstance *aInstance, const fd_set *aReadFdSet, const
exit(EXIT_FAILURE);
}
}
#endif
#endif // OPENTHREAD_SIMULATION_VIRTUAL_TIME == 0
if (platformRadioIsTransmitPending())
{
radioSendMessage(aInstance);
@@ -870,7 +937,7 @@ void radioTransmit(struct RadioMessage *aMessage, const struct otRadioFrame *aFr
sockaddr.sin_family = AF_INET;
inet_pton(AF_INET, OT_RADIO_GROUP, &sockaddr.sin_addr);
sockaddr.sin_port = htons((uint16_t)(9000 + sPortOffset));
sockaddr.sin_port = htons((uint16_t)(sPortBase + sPortOffset));
rval =
sendto(sTxFd, (const char *)aMessage, 1 + aFrame->mLength, 0, (struct sockaddr *)&sockaddr, sizeof(sockaddr));
@@ -1321,3 +1388,43 @@ otError otPlatRadioGetRegion(otInstance *aInstance, uint16_t *aRegionCode)
exit:
return error;
}
void parseFromEnvAsUint16(const char *aEnvName, uint16_t *aValue)
{
char *env = getenv(aEnvName);
if (env)
{
char *endptr;
*aValue = (uint16_t)strtol(env, &endptr, 0);
if (*endptr != '\0')
{
fprintf(stderr, "Invalid %s: %s\n", aEnvName, env);
exit(EXIT_FAILURE);
}
}
}
otError otPlatDiagGpioSet(uint32_t aGpio, bool aValue)
{
otError error = OT_ERROR_NONE;
otEXPECT_ACTION(aGpio == SIM_GPIO, error = OT_ERROR_INVALID_ARGS);
sGpioValue = aValue;
exit:
return error;
}
otError otPlatDiagGpioGet(uint32_t aGpio, bool *aValue)
{
otError error = OT_ERROR_NONE;
otEXPECT_ACTION((aGpio == SIM_GPIO) && (aValue != NULL), error = OT_ERROR_INVALID_ARGS);
*aValue = sGpioValue;
exit:
return error;
}
@@ -61,6 +61,7 @@ char **gArguments = NULL;
uint64_t sNow = 0; // microseconds
int sSockFd;
uint16_t sPortBase = 9000;
uint16_t sPortOffset;
static void handleSignal(int aSignal)
@@ -78,7 +79,7 @@ void otSimSendEvent(const struct Event *aEvent)
memset(&sockaddr, 0, sizeof(sockaddr));
sockaddr.sin_family = AF_INET;
inet_pton(AF_INET, "127.0.0.1", &sockaddr.sin_addr);
sockaddr.sin_port = htons(9000 + sPortOffset);
sockaddr.sin_port = htons(sPortBase + sPortOffset);
rval = sendto(sSockFd, aEvent, offsetof(struct Event, mData) + aEvent->mDataLength, 0, (struct sockaddr *)&sockaddr,
sizeof(sockaddr));
@@ -176,28 +177,15 @@ otError otPlatUartFlush(void)
static void socket_init(void)
{
struct sockaddr_in sockaddr;
char * offset;
memset(&sockaddr, 0, sizeof(sockaddr));
sockaddr.sin_family = AF_INET;
offset = getenv("PORT_OFFSET");
parseFromEnvAsUint16("PORT_BASE", &sPortBase);
if (offset)
{
char *endptr;
parseFromEnvAsUint16("PORT_OFFSET", &sPortOffset);
sPortOffset *= (MAX_NETWORK_SIZE + 1);
sPortOffset = (uint16_t)strtol(offset, &endptr, 0);
if (*endptr != '\0')
{
fprintf(stderr, "Invalid PORT_OFFSET: %s\n", offset);
exit(EXIT_FAILURE);
}
sPortOffset *= (MAX_NETWORK_SIZE + 1);
}
sockaddr.sin_port = htons((uint16_t)(9000 + sPortOffset + gNodeId));
sockaddr.sin_port = htons((uint16_t)(sPortBase + sPortOffset + gNodeId));
sockaddr.sin_addr.s_addr = INADDR_ANY;
sSockFd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
+1 -1
View File
@@ -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; };
@@ -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
+3
View File
@@ -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.
+2
View File
@@ -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 \
+2
View File
@@ -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",
+37 -14
View File
@@ -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.
+1 -106
View File
@@ -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.
*
+287
View File
@@ -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_
+14 -14
View File
@@ -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%.
+3 -3
View File
@@ -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.
+4 -4
View File
@@ -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.
+3 -3
View File
@@ -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;
/**
+11 -9
View File
@@ -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.
+3 -3
View File
@@ -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.
+10 -6
View File
@@ -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.
+6 -1
View File
@@ -85,8 +85,13 @@ otError otDiagProcessCmd(otInstance *aInstance,
* @param[out] aOutput The diagnostics execution result.
* @param[in] aOutputMaxLen The output buffer size.
*
* @retval OT_ERROR_NONE The command is successfully process.
* @retval OT_ERROR_INVALID_ARGS The command is supported but invalid arguments provided.
* @retval OT_ERROR_NOT_IMPLEMENTED The command is not supported.
* @retval OT_ERROR_NO_BUFS The command string is too long.
*
*/
void otDiagProcessCmdLine(otInstance *aInstance, const char *aString, char *aOutput, size_t aOutputMaxLen);
otError otDiagProcessCmdLine(otInstance *aInstance, const char *aString, char *aOutput, size_t aOutputMaxLen);
/**
* This function indicates whether or not the factory diagnostics mode is enabled.
+4 -1
View File
@@ -323,7 +323,8 @@ typedef struct otDnsServiceInfo
otIp6Address mHostAddress; ///< The host IPv6 address. Set to all zero if not available.
uint32_t mHostAddressTtl; ///< The host address TTL.
uint8_t * mTxtData; ///< Buffer to output TXT data (can be NULL if not needed).
uint16_t mTxtDataSize; ///< On input, size of `mTxtData` buffer. On output `mTxtData` length.
uint16_t mTxtDataSize; ///< On input, size of `mTxtData` buffer. On output number bytes written.
bool mTxtDataTruncated; ///< Indicates if TXT data could not fit in `mTxtDataSize` and was truncated.
uint32_t mTxtDataTtl; ///< The TXT data TTL.
} otDnsServiceInfo;
@@ -408,6 +409,7 @@ otError otDnsBrowseResponseGetServiceInstance(const otDnsBrowseResponse *aRespon
* - If no matching SRV record is found in @p aResponse, `OT_ERROR_NOT_FOUND` is returned.
* - If a matching SRV record is found in @p aResponse, @p aServiceInfo is updated and `OT_ERROR_NONE` is returned.
* - If no matching TXT record is found in @p aResponse, `mTxtDataSize` in @p aServiceInfo is set to zero.
* - If TXT data length is greater than `mTxtDataSize`, it is read partially and `mTxtDataTruncated` is set to true.
* - If no matching AAAA record is found in @p aResponse, `mHostAddress is set to all zero or unspecified address.
* - If there are multiple AAAA records for the host name in @p aResponse, `mHostAddress` is set to the first one. The
* other addresses can be retrieved using `otDnsBrowseResponseGetHostAddress()`.
@@ -537,6 +539,7 @@ otError otDnsServiceResponseGetServiceName(const otDnsServiceResponse *aResponse
* - If no matching SRV record is found in @p aResponse, `OT_ERROR_NOT_FOUND` is returned.
* - If a matching SRV record is found in @p aResponse, @p aServiceInfo is updated and `OT_ERROR_NONE` is returned.
* - If no matching TXT record is found in @p aResponse, `mTxtDataSize` in @p aServiceInfo is set to zero.
* - If TXT data length is greater than `mTxtDataSize`, it is read partially and `mTxtDataTruncated` is set to true.
* - If no matching AAAA record is found in @p aResponse, `mHostAddress is set to all zero or unspecified address.
* - If there are multiple AAAA records for the host name in @p aResponse, `mHostAddress` is set to the first one. The
* other addresses can be retrieved using `otDnsServiceResponseGetHostAddress()`.
+2
View File
@@ -66,6 +66,8 @@ typedef enum otIcmp6Type
OT_ICMP6_TYPE_ECHO_REPLY = 129, ///< Echo Reply
OT_ICMP6_TYPE_ROUTER_SOLICIT = 133, ///< Router Solicitation
OT_ICMP6_TYPE_ROUTER_ADVERT = 134, ///< Router Advertisement
OT_ICMP6_TYPE_NEIGHBOR_SOLICIT = 135, ///< Neighbor Solicitation
OT_ICMP6_TYPE_NEIGHBOR_ADVERT = 136, ///< Neighbor Advertisement
} otIcmp6Type;
/**
+2 -2
View File
@@ -53,7 +53,7 @@ extern "C" {
* @note This number versions both OpenThread platform and user APIs.
*
*/
#define OPENTHREAD_API_VERSION (223)
#define OPENTHREAD_API_VERSION (257)
/**
* @addtogroup api-instance
@@ -250,7 +250,7 @@ void otRemoveStateChangeCallback(otInstance *aInstance, otStateChangedCallback a
void otInstanceReset(otInstance *aInstance);
/**
* This method deletes all the settings stored on non-volatile memory, and then triggers platform reset.
* Deletes all the settings stored on non-volatile memory, and then triggers a platform reset.
*
* @param[in] aInstance A pointer to an OpenThread instance.
*
+26 -15
View File
@@ -257,9 +257,9 @@ enum
};
/**
* This function brings up/down the IPv6 interface.
* Brings the IPv6 interface up or down.
*
* Call this function to enable/disable IPv6 communication.
* Call this to enable or disable IPv6 communication.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in] aEnabled TRUE to enable IPv6, FALSE otherwise.
@@ -272,7 +272,7 @@ enum
otError otIp6SetEnabled(otInstance *aInstance, bool aEnabled);
/**
* This function indicates whether or not the IPv6 interface is up.
* Indicates whether or not the IPv6 interface is up.
*
* @param[in] aInstance A pointer to an OpenThread instance.
*
@@ -283,10 +283,10 @@ otError otIp6SetEnabled(otInstance *aInstance, bool aEnabled);
bool otIp6IsEnabled(otInstance *aInstance);
/**
* Add a Network Interface Address to the Thread interface.
* Adds a Network Interface Address to the Thread interface.
*
* The passed-in instance @p aAddress is copied by the Thread interface. The Thread interface only
* supports a fixed number of externally added unicast addresses. See OPENTHREAD_CONFIG_IP6_MAX_EXT_UCAST_ADDRS.
* supports a fixed number of externally added unicast addresses. See `OPENTHREAD_CONFIG_IP6_MAX_EXT_UCAST_ADDRS`.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in] aAddress A pointer to a Network Interface Address.
@@ -298,7 +298,7 @@ bool otIp6IsEnabled(otInstance *aInstance);
otError otIp6AddUnicastAddress(otInstance *aInstance, const otNetifAddress *aAddress);
/**
* Remove a Network Interface Address from the Thread interface.
* Removes a Network Interface Address from the Thread interface.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in] aAddress A pointer to an IP Address.
@@ -310,7 +310,7 @@ otError otIp6AddUnicastAddress(otInstance *aInstance, const otNetifAddress *aAdd
otError otIp6RemoveUnicastAddress(otInstance *aInstance, const otIp6Address *aAddress);
/**
* Get the list of IPv6 addresses assigned to the Thread interface.
* Gets the list of IPv6 addresses assigned to the Thread interface.
*
* @param[in] aInstance A pointer to an OpenThread instance.
*
@@ -319,10 +319,10 @@ otError otIp6RemoveUnicastAddress(otInstance *aInstance, const otIp6Address *aAd
const otNetifAddress *otIp6GetUnicastAddresses(otInstance *aInstance);
/**
* Subscribe the Thread interface to a Network Interface Multicast Address.
* Subscribes the Thread interface to a Network Interface Multicast Address.
*
* The passed in instance @p aAddress will be copied by the Thread interface. The Thread interface only
* supports a fixed number of externally added multicast addresses. See OPENTHREAD_CONFIG_IP6_MAX_EXT_MCAST_ADDRS.
* supports a fixed number of externally added multicast addresses. See `OPENTHREAD_CONFIG_IP6_MAX_EXT_MCAST_ADDRS`.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in] aAddress A pointer to an IP Address.
@@ -338,7 +338,7 @@ const otNetifAddress *otIp6GetUnicastAddresses(otInstance *aInstance);
otError otIp6SubscribeMulticastAddress(otInstance *aInstance, const otIp6Address *aAddress);
/**
* Unsubscribe the Thread interface to a Network Interface Multicast Address.
* Unsubscribes the Thread interface to a Network Interface Multicast Address.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in] aAddress A pointer to an IP Address.
@@ -351,7 +351,7 @@ otError otIp6SubscribeMulticastAddress(otInstance *aInstance, const otIp6Address
otError otIp6UnsubscribeMulticastAddress(otInstance *aInstance, const otIp6Address *aAddress);
/**
* Get the list of IPv6 multicast addresses subscribed to the Thread interface.
* Gets the list of IPv6 multicast addresses subscribed to the Thread interface.
*
* @param[in] aInstance A pointer to an OpenThread instance.
*
@@ -361,7 +361,7 @@ otError otIp6UnsubscribeMulticastAddress(otInstance *aInstance, const otIp6Addre
const otNetifMulticastAddress *otIp6GetMulticastAddresses(otInstance *aInstance);
/**
* Check if multicast promiscuous mode is enabled on the Thread interface.
* Checks if multicast promiscuous mode is enabled on the Thread interface.
*
* @param[in] aInstance A pointer to an OpenThread instance.
*
@@ -371,7 +371,7 @@ const otNetifMulticastAddress *otIp6GetMulticastAddresses(otInstance *aInstance)
bool otIp6IsMulticastPromiscuousEnabled(otInstance *aInstance);
/**
* Enable multicast promiscuous mode on the Thread interface.
* Enables or disables multicast promiscuous mode on the Thread interface.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in] aEnabled TRUE to enable Multicast Promiscuous mode, FALSE otherwise.
@@ -638,8 +638,9 @@ void otIp6AddressToString(const otIp6Address *aAddress, char *aBuffer, uint16_t
/**
* This function converts a given IPv6 socket address to a human-readable string.
*
* The IPv6 socket address string is formatted as "[<address>]:<port>" where `<address> is shown as 16 hex values
* separated by ':' and `<port>` is the port number in decimal format (i.e., "[%x:%x:...:%x]:%u")
* The IPv6 socket address string is formatted as [`address`]:`port` where `address` is shown
* as 16 hex values separated by `:` and `port` is the port number in decimal format,
* for example "[%x:%x:...:%x]:%u".
*
* If the resulting string does not fit in @p aBuffer (within its @p aSize characters), the string will be truncated
* but the outputted string is always null-terminated.
@@ -679,6 +680,16 @@ void otIp6PrefixToString(const otIp6Prefix *aPrefix, char *aBuffer, uint16_t aSi
*/
uint8_t otIp6PrefixMatch(const otIp6Address *aFirst, const otIp6Address *aSecond);
/**
* This method gets a prefix with @p aLength from @p aAddress.
*
* @param[in] aAddress A pointer to an IPv6 address.
* @param[in] aLength The length of prefix in bits.
* @param[out] aPrefix A pointer to output the IPv6 prefix.
*
*/
void otIp6GetPrefix(const otIp6Address *aAddress, uint8_t aLength, otIp6Prefix *aPrefix);
/**
* This function indicates whether or not a given IPv6 address is the Unspecified Address.
*
+7 -7
View File
@@ -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.
+2 -2
View File
@@ -170,7 +170,7 @@ otError otLinkMetricsQuery(otInstance * aInstance,
void * aCallbackContext);
/**
* This function sends an MLE Link Metrics Management Request to configure/clear a Forward Tracking Series.
* Sends an MLE Link Metrics Management Request to configure or clear a Forward Tracking Series.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in] aDestination A pointer to the destination address.
@@ -228,7 +228,7 @@ otError otLinkMetricsConfigEnhAckProbing(otInstance *
void * aEnhAckCallbackContext);
/**
* This function sends an MLE Link Probe message.
* Sends an MLE Link Probe message.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in] aDestination A pointer to the destination address.
+2 -2
View File
@@ -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.
+489
View File
@@ -0,0 +1,489 @@
/*
* Copyright (c) 2022, The OpenThread Authors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/**
* @file
* @brief
* This file defines the OpenThread API for NAT64 on a border router.
*/
#ifndef OPENTHREAD_NAT64_H_
#define OPENTHREAD_NAT64_H_
#include <openthread/ip6.h>
#include <openthread/message.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @addtogroup api-nat64
*
* @brief This module includes functions and structs for the NAT64 function on the border router. These functions are
* only available when `OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE` is enabled.
*
* @{
*
*/
#define OT_IP4_ADDRESS_SIZE 4 ///< Size of an IPv4 address (bytes)
/**
* @struct otIp4Address
*
* This structure represents an IPv4 address.
*
*/
OT_TOOL_PACKED_BEGIN
struct otIp4Address
{
union OT_TOOL_PACKED_FIELD
{
uint8_t m8[OT_IP4_ADDRESS_SIZE]; ///< 8-bit fields
uint32_t m32; ///< 32-bit representation
} mFields;
} OT_TOOL_PACKED_END;
/**
* This structure represents an IPv4 address.
*
*/
typedef struct otIp4Address otIp4Address;
/**
* @struct otIp4Cidr
*
* This structure represents an IPv4 CIDR block.
*
*/
typedef struct otIp4Cidr
{
otIp4Address mAddress;
uint8_t mLength;
} otIp4Cidr;
/**
* Represents the counters for NAT64.
*
*/
typedef struct otNat64Counters
{
uint64_t m4To6Packets; ///< Number of packets translated from IPv4 to IPv6.
uint64_t m4To6Bytes; ///< Sum of size of packets translated from IPv4 to IPv6.
uint64_t m6To4Packets; ///< Number of packets translated from IPv6 to IPv4.
uint64_t m6To4Bytes; ///< Sum of size of packets translated from IPv6 to IPv4.
} otNat64Counters;
/**
* Represents the counters for the protocols supported by NAT64.
*
*/
typedef struct otNat64ProtocolCounters
{
otNat64Counters mTotal; ///< Counters for sum of all protocols.
otNat64Counters mIcmp; ///< Counters for ICMP and ICMPv6.
otNat64Counters mUdp; ///< Counters for UDP.
otNat64Counters mTcp; ///< Counters for TCP.
} otNat64ProtocolCounters;
/**
* Packet drop reasons.
*
*/
typedef enum otNat64DropReason
{
OT_NAT64_DROP_REASON_UNKNOWN = 0, ///< Packet drop for unknown reasons.
OT_NAT64_DROP_REASON_ILLEGAL_PACKET, ///< Packet drop due to failed to parse the datagram.
OT_NAT64_DROP_REASON_UNSUPPORTED_PROTO, ///< Packet drop due to unsupported IP protocol.
OT_NAT64_DROP_REASON_NO_MAPPING, ///< Packet drop due to no mappings found or mapping pool exhausted.
//---
OT_NAT64_DROP_REASON_COUNT,
} otNat64DropReason;
/**
* Represents the counters of dropped packets due to errors when handling NAT64 packets.
*
*/
typedef struct otNat64ErrorCounters
{
uint64_t mCount4To6[OT_NAT64_DROP_REASON_COUNT]; ///< Errors translating IPv4 packets.
uint64_t mCount6To4[OT_NAT64_DROP_REASON_COUNT]; ///< Errors translating IPv6 packets.
} otNat64ErrorCounters;
/**
* Gets NAT64 translator counters.
*
* The counter is counted since the instance initialized.
*
* Available when `OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE` is enabled.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[out] aCounters A pointer to an `otNat64Counters` where the counters of NAT64 translator will be placed.
*
*/
void otNat64GetCounters(otInstance *aInstance, otNat64ProtocolCounters *aCounters);
/**
* Gets the NAT64 translator error counters.
*
* The counters are initialized to zero when the OpenThread instance is initialized.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[out] aCounters A pointer to an `otNat64Counters` where the counters of NAT64 translator will be placed.
*
*/
void otNat64GetErrorCounters(otInstance *aInstance, otNat64ErrorCounters *aCounters);
/**
* Represents an address mapping record for NAT64.
*
* @note The counters will be reset for each mapping session even for the same address pair. Applications can use `mId`
* to identify different sessions to calculate the packets correctly.
*
*/
typedef struct otNat64AddressMapping
{
uint64_t mId; ///< The unique id for a mapping session.
otIp4Address mIp4; ///< The IPv4 address of the mapping.
otIp6Address mIp6; ///< The IPv6 address of the mapping.
uint32_t mRemainingTimeMs; ///< Remaining time before expiry in milliseconds.
otNat64ProtocolCounters mCounters;
} otNat64AddressMapping;
/**
* Used to iterate through NAT64 address mappings.
*
* The fields in this type are opaque (intended for use by OpenThread core only) and therefore should not be
* accessed or used by caller.
*
* Before using an iterator, it MUST be initialized using `otNat64AddressMappingIteratorInit()`.
*
*/
typedef struct otNat64AddressMappingIterator
{
void *mPtr;
} otNat64AddressMappingIterator;
/**
* Initializes an `otNat64AddressMappingIterator`.
*
* An iterator MUST be initialized before it is used.
*
* An iterator can be initialized again to restart from the beginning of the mapping info.
*
* @param[in] aInstance The OpenThread instance.
* @param[out] aIterator A pointer to the iterator to initialize.
*
*/
void otNat64InitAddressMappingIterator(otInstance *aInstance, otNat64AddressMappingIterator *aIterator);
/**
* Gets the next AddressMapping info (using an iterator).
*
* Available when `OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE` is enabled.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in,out] aIterator A pointer to the iterator. On success the iterator will be updated to point to next
* NAT64 address mapping record. To get the first entry the iterator should be set to
* OT_NAT64_ADDRESS_MAPPING_ITERATOR_INIT.
* @param[out] aMapping A pointer to an `otNat64AddressMapping` where information of next NAT64 address
* mapping record is placed (on success).
*
* @retval OT_ERROR_NONE Successfully found the next NAT64 address mapping info (@p aMapping was successfully
* updated).
* @retval OT_ERROR_NOT_FOUND No subsequent NAT64 address mapping info was found.
*
*/
otError otNat64GetNextAddressMapping(otInstance * aInstance,
otNat64AddressMappingIterator *aIterator,
otNat64AddressMapping * aMapping);
/**
* States of NAT64.
*
*/
typedef enum
{
OT_NAT64_STATE_DISABLED = 0, ///< NAT64 is disabled.
OT_NAT64_STATE_NOT_RUNNING, ///< NAT64 is enabled, but one or more dependencies of NAT64 are not running.
OT_NAT64_STATE_IDLE, ///< NAT64 is enabled, but this BR is not an active NAT64 BR.
OT_NAT64_STATE_ACTIVE, ///< The BR is publishing a NAT64 prefix and/or translating packets.
} otNat64State;
/**
* Gets the state of NAT64 translator.
*
* Available when `OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE` is enabled.
*
* @param[in] aInstance A pointer to an OpenThread instance.
*
* @retval OT_NAT64_STATE_DISABLED NAT64 translator is disabled.
* @retval OT_NAT64_STATE_NOT_RUNNING NAT64 translator is enabled, but the translator is not configured with a valid
* NAT64 prefix and a CIDR.
* @retval OT_NAT64_STATE_ACTIVE NAT64 translator is enabled, and is translating packets.
*
*/
otNat64State otNat64GetTranslatorState(otInstance *aInstance);
/**
* Gets the state of NAT64 prefix manager.
*
* Available when `OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE` is enabled.
*
* @param[in] aInstance A pointer to an OpenThread instance.
*
* @retval OT_NAT64_STATE_DISABLED NAT64 prefix manager is disabled.
* @retval OT_NAT64_STATE_NOT_RUNNING NAT64 prefix manager is enabled, but is not running (because the routing manager
* is not running).
* @retval OT_NAT64_STATE_IDLE NAT64 prefix manager is enabled, but is not publishing a NAT64 prefix. Usually
* when there is another border router publishing a NAT64 prefix with higher
* priority.
* @retval OT_NAT64_STATE_ACTIVE NAT64 prefix manager is enabled, and is publishing NAT64 prefix to the Thread
* network.
*
*/
otNat64State otNat64GetPrefixManagerState(otInstance *aInstance);
/**
* Enable or disable NAT64 functions.
*
* Note: This includes the NAT64 Translator (when `OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE` is enabled) and the NAT64
* Prefix Manager (when `OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE` is enabled).
*
* When `OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE` is enabled, setting disabled to true resets the
* mapping table in the translator.
*
* Available when `OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE` or `OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE` is
* enabled.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in] aEnabled A boolean to enable/disable the NAT64 functions
*
* @sa otNat64GetTranslatorState
* @sa otNat64GetPrefixManagerState
*
*/
void otNat64SetEnabled(otInstance *aInstance, bool aEnable);
/**
* Allocate a new message buffer for sending an IPv4 message to the NAT64 translator.
*
* Message buffers allocated by this function will have 20 bytes (difference between the size of IPv6 headers
* and IPv4 header sizes) reserved.
*
* Available when `OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE` is enabled.
*
* @note If @p aSettings is `NULL`, the link layer security is enabled and the message priority is set to
* OT_MESSAGE_PRIORITY_NORMAL by default.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in] aSettings A pointer to the message settings or NULL to set default settings.
*
* @returns A pointer to the message buffer or NULL if no message buffers are available or parameters are invalid.
*
* @sa otNat64Send
*
*/
otMessage *otIp4NewMessage(otInstance *aInstance, const otMessageSettings *aSettings);
/**
* Sets the CIDR used when setting the source address of the outgoing translated IPv4 packets.
*
* This function is available only when OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE is enabled.
*
* @note A valid CIDR must have a non-zero prefix length. The actual addresses pool is limited by the size of the
* mapping pool and the number of addresses available in the CIDR block.
*
* @note This function can be called at any time, but the NAT64 translator will be reset and all existing sessions will
* be expired when updating the configured CIDR.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in] aCidr A pointer to an otIp4Cidr for the IPv4 CIDR block for NAT64.
*
* @retval OT_ERROR_INVALID_ARGS The given CIDR is not a valid IPv4 CIDR for NAT64.
* @retval OT_ERROR_NONE Successfully set the CIDR for NAT64.
*
* @sa otBorderRouterSend
* @sa otBorderRouterSetReceiveCallback
*
*/
otError otNat64SetIp4Cidr(otInstance *aInstance, const otIp4Cidr *aCidr);
/**
* Translates an IPv4 datagram to an IPv6 datagram and sends via the Thread interface.
*
* The caller transfers ownership of @p aMessage when making this call. OpenThread will free @p aMessage when
* processing is complete, including when a value other than `OT_ERROR_NONE` is returned.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in] aMessage A pointer to the message buffer containing the IPv4 datagram.
*
* @retval OT_ERROR_NONE Successfully processed the message.
* @retval OT_ERROR_DROP Message was well-formed but not fully processed due to packet processing
* rules.
* @retval OT_ERROR_NO_BUFS Could not allocate necessary message buffers when processing the datagram.
* @retval OT_ERROR_NO_ROUTE No route to host.
* @retval OT_ERROR_INVALID_SOURCE_ADDRESS Source address is invalid, e.g. an anycast address or a multicast address.
* @retval OT_ERROR_PARSE Encountered a malformed header when processing the message.
*
*/
otError otNat64Send(otInstance *aInstance, otMessage *aMessage);
/**
* This function pointer is called when an IPv4 datagram (translated by NAT64 translator) is received.
*
* @param[in] aMessage A pointer to the message buffer containing the received IPv6 datagram. This function transfers
* the ownership of the @p aMessage to the receiver of the callback. The message should be
* freed by the receiver of the callback after it is processed.
* @param[in] aContext A pointer to application-specific context.
*
*/
typedef void (*otNat64ReceiveIp4Callback)(otMessage *aMessage, void *aContext);
/**
* Registers a callback to provide received IPv4 datagrams.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in] aCallback A pointer to a function that is called when an IPv4 datagram is received or
* NULL to disable the callback.
* @param[in] aCallbackContext A pointer to application-specific context.
*
*/
void otNat64SetReceiveIp4Callback(otInstance *aInstance, otNat64ReceiveIp4Callback aCallback, void *aContext);
/**
* Gets the IPv4 CIDR configured in the NAT64 translator.
*
* Available when `OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE` is enabled.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[out] aCidr A pointer to an otIp4Cidr. Where the CIDR will be filled.
*
*/
otError otNat64GetCidr(otInstance *aInstance, otIp4Cidr *aCidr);
/**
* Test if two IPv4 addresses are the same.
*
* @param[in] aFirst A pointer to the first IPv4 address to compare.
* @param[in] aSecond A pointer to the second IPv4 address to compare.
*
* @retval TRUE The two IPv4 addresses are the same.
* @retval FALSE The two IPv4 addresses are not the same.
*
*/
bool otIp4IsAddressEqual(const otIp4Address *aFirst, const otIp4Address *aSecond);
/**
* Set @p aIp4Address by performing NAT64 address translation from @p aIp6Address as specified
* in RFC 6052.
*
* The NAT64 @p aPrefixLength MUST be one of the following values: 32, 40, 48, 56, 64, or 96, otherwise the behavior
* of this method is undefined.
*
* @param[in] aPrefixLength The prefix length to use for IPv4/IPv6 translation.
* @param[in] aIp6Address A pointer to an IPv6 address.
* @param[out] aIp4Address A pointer to output the IPv4 address.
*
*/
void otIp4ExtractFromIp6Address(uint8_t aPrefixLength, const otIp6Address *aIp6Address, otIp4Address *aIp4Address);
#define OT_IP4_ADDRESS_STRING_SIZE 17 ///< Length of 000.000.000.000 plus a suffix NUL
/**
* Converts the address to a string.
*
* The string format uses quad-dotted notation of four bytes in the address (e.g., "127.0.0.1").
*
* If the resulting string does not fit in @p aBuffer (within its @p aSize characters), the string will be
* truncated but the outputted string is always null-terminated.
*
* @param[in] aAddress A pointer to an IPv4 address (MUST NOT be NULL).
* @param[out] aBuffer A pointer to a char array to output the string (MUST NOT be `nullptr`).
* @param[in] aSize The size of @p aBuffer (in bytes).
*
*/
void otIp4AddressToString(const otIp4Address *aAddress, char *aBuffer, uint16_t aSize);
#define OT_IP4_CIDR_STRING_SIZE 20 ///< Length of 000.000.000.000/00 plus a suffix NUL
/**
* Converts the IPv4 CIDR to a string.
*
* The string format uses quad-dotted notation of four bytes in the address with the length of prefix (e.g.,
* "127.0.0.1/32").
*
* If the resulting string does not fit in @p aBuffer (within its @p aSize characters), the string will be
* truncated but the outputted string is always null-terminated.
*
* @param[in] aCidr A pointer to an IPv4 CIDR (MUST NOT be NULL).
* @param[out] aBuffer A pointer to a char array to output the string (MUST NOT be `nullptr`).
* @param[in] aSize The size of @p aBuffer (in bytes).
*
*/
void otIp4CidrToString(const otIp4Cidr *aCidr, char *aBuffer, uint16_t aSize);
/**
* Converts a human-readable IPv4 address string into a binary representation.
*
* @param[in] aString A pointer to a NULL-terminated string.
* @param[out] aAddress A pointer to an IPv4 address.
*
* @retval OT_ERROR_NONE Successfully parsed the string.
* @retval OT_ERROR_INVALID_ARGS Failed to parse the string.
*
*/
otError otIp4AddressFromString(const char *aString, otIp4Address *aAddress);
/**
* Sets the IPv6 address by performing NAT64 address translation from the preferred NAT64 prefix and the given IPv4
* address as specified in RFC 6052.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in] aIp4Address A pointer to the IPv4 address to translate to IPv6.
* @param[out] aIp6Address A pointer to the synthesized IPv6 address.
*
* @returns OT_ERROR_NONE Successfully synthesized the IPv6 address from NAT64 prefix and IPv4 address.
* @returns OT_ERROR_INVALID_STATE No valid NAT64 prefix in the network data.
*
*/
otError otNat64SynthesizeIp6Address(otInstance *aInstance, const otIp4Address *aIp4Address, otIp6Address *aIp6Address);
/**
* @}
*
*/
#ifdef __cplusplus
}
#endif
#endif // OPENTHREAD_NAT64_H_
+26
View File
@@ -129,6 +129,32 @@ void otPlatDiagRadioReceived(otInstance *aInstance, otRadioFrame *aFrame, otErro
*/
void otPlatDiagAlarmCallback(otInstance *aInstance);
/**
* This function sets the gpio value.
*
* @param[in] aGpio The gpio number.
* @param[in] aValue true to set the gpio to high level, or false otherwise.
*
* @retval OT_ERROR_NONE Successfully set the gpio.
* @retval OT_ERROR_INVALID_ARGS @p aGpio is not supported.
* @retval OT_ERROR_NOT_IMPLEMENTED This function is not implemented on the platform.
*
*/
otError otPlatDiagGpioSet(uint32_t aGpio, bool aValue);
/**
* This function gets the gpio value.
*
* @param[in] aGpio The gpio number.
* @param[out] aValue A pointer where to put gpio value.
*
* @retval OT_ERROR_NONE Successfully got the gpio value.
* @retval OT_ERROR_INVALID_ARGS @p aGpio is not supported or @p aValue is NULL.
* @retval OT_ERROR_NOT_IMPLEMENTED This function is not implemented on the platform.
*
*/
otError otPlatDiagGpioGet(uint32_t aGpio, bool *aValue);
/**
* @}
*
+44
View File
@@ -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
+3 -3
View File
@@ -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.
*
+1
View File
@@ -72,6 +72,7 @@ enum
OT_SETTINGS_KEY_SRP_CLIENT_INFO = 0x000c, ///< The SRP client info (selected SRP server address).
OT_SETTINGS_KEY_SRP_SERVER_INFO = 0x000d, ///< The SRP server info (UDP port).
OT_SETTINGS_KEY_BR_ULA_PREFIX = 0x000f, ///< BR ULA prefix.
OT_SETTINGS_KEY_BR_ON_LINK_PREFIXES = 0x0010, ///< BR local on-link prefixes.
// Deprecated and reserved key values:
//
+27
View File
@@ -110,6 +110,24 @@ extern "C" {
*
*/
/**
* @def OT_TOOL_PRINTF_STYLE_FORMAT_ARG_CHECK
*
* This macro specifies that a function or method takes `printf` style arguments and should be type-checked against
* a format string.
*
* This macro must be added after the function/method declaration. For example:
*
* `void MyPrintf(void *aObject, const char *aFormat, ...) OT_TOOL_PRINTF_STYLE_FORMAT_ARG_CHECK(2, 3);`
*
* The two argument index values indicate format string and first argument to check against it. They start at index 1
* for the first parameter in a function and at index 2 for the first parameter in a method.
*
* @param[in] aFmtIndex The argument index of the format string.
* @param[in] aStartIndex The argument index of the first argument to check against the format string.
*
*/
// =========== TOOLCHAIN SELECTION : START ===========
#if defined(__GNUC__) || defined(__clang__) || defined(__CC_ARM) || defined(__TI_ARM__)
@@ -122,6 +140,9 @@ extern "C" {
#define OT_TOOL_PACKED_END __attribute__((packed))
#define OT_TOOL_WEAK __attribute__((weak))
#define OT_TOOL_PRINTF_STYLE_FORMAT_ARG_CHECK(aFmtIndex, aStartIndex) \
__attribute__((format(printf, aFmtIndex, aStartIndex)))
#elif defined(__ICCARM__) || defined(__ICC8051__)
// http://supp.iar.com/FilesPublic/UPDINFO/004916/arm/doc/EWARM_DevelopmentGuide.ENU.pdf
@@ -133,6 +154,8 @@ extern "C" {
#define OT_TOOL_PACKED_END
#define OT_TOOL_WEAK __weak
#define OT_TOOL_PRINTF_STYLE_FORMAT_ARG_CHECK(aFmtIndex, aStartIndex)
#elif defined(__SDCC)
// Structures are packed by default in sdcc, as it primarily targets 8-bit MCUs.
@@ -142,6 +165,8 @@ extern "C" {
#define OT_TOOL_PACKED_END
#define OT_TOOL_WEAK
#define OT_TOOL_PRINTF_STYLE_FORMAT_ARG_CHECK(aFmtIndex, aStartIndex)
#else
#error "Error: No valid Toolchain specified"
@@ -153,6 +178,8 @@ extern "C" {
#define OT_TOOL_PACKED_END
#define OT_TOOL_WEAK
#define OT_TOOL_PRINTF_STYLE_FORMAT_ARG_CHECK(aFmtIndex, aStartIndex)
#endif
// =========== TOOLCHAIN SELECTION : END ===========
+56 -28
View File
@@ -88,28 +88,34 @@ typedef struct otSrpClientHostInfo
* and stay constant after an instance of this structure is passed to OpenThread from `otSrpClientAddService()` or
* `otSrpClientRemoveService()`.
*
* The `mState`, `mData`, `mNext` fields are used/managed by OT core only. Their value is ignored when an instance of
* `otSrpClientService` is passed in `otSrpClientAddService()` or `otSrpClientRemoveService()` or other functions. The
* caller does not need to set these fields.
*
* The `mLease` and `mKeyLease` fields specify the desired lease and key lease intervals for this service. Zero value
* indicates that the interval is unspecified and then the default lease or key lease intervals from
* `otSrpClientGetLeaseInterval()` and `otSrpClientGetKeyLeaseInterval()` are used for this service. If the key lease
* interval (whether set explicitly or determined from the default) is shorter than the lease interval for a service,
* SRP client will re-use the lease interval value for key lease interval as well. For example, if in service `mLease`
* is explicitly set to 2 days and `mKeyLease` is set to zero and default key lease is set to 1 day, then when
* registering this service, the requested key lease for this service is also set to 2 days.
*
*/
typedef struct otSrpClientService
{
const char * mName; ///< The service name labels (e.g., "_chip._udp", not the full domain name).
const char * mInstanceName; ///< The service instance name label (not the full name).
const char *const * mSubTypeLabels; ///< Array of service sub-type labels (must end with `NULL` or can be `NULL`).
const otDnsTxtEntry *mTxtEntries; ///< Array of TXT entries (number of entries is given by `mNumTxtEntries`).
uint16_t mPort; ///< The service port number.
uint16_t mPriority; ///< The service priority.
uint16_t mWeight; ///< The service weight.
uint8_t mNumTxtEntries; ///< Number of entries in the `mTxtEntries` array.
/**
* @note The following fields are used/managed by OT core only. Their values do not matter and are ignored when an
* instance of `otSrpClientService` is passed in `otSrpClientAddService()` or `otSrpClientRemoveService()`. The
* user should not modify these fields.
*
*/
otSrpClientItemState mState; ///< Service state (managed by OT core).
uint32_t mData; ///< Internal data (used by OT core).
struct otSrpClientService *mNext; ///< Pointer to next entry in a linked-list (managed by OT core).
const char * mName; ///< The service labels (e.g., "_mt._udp", not the full domain name).
const char * mInstanceName; ///< The service instance name label (not the full name).
const char *const * mSubTypeLabels; ///< Array of sub-type labels (must end with `NULL` or can be `NULL`).
const otDnsTxtEntry * mTxtEntries; ///< Array of TXT entries (`mNumTxtEntries` gives num of entries).
uint16_t mPort; ///< The service port number.
uint16_t mPriority; ///< The service priority.
uint16_t mWeight; ///< The service weight.
uint8_t mNumTxtEntries; ///< Number of entries in the `mTxtEntries` array.
otSrpClientItemState mState; ///< Service state (managed by OT core).
uint32_t mData; ///< Internal data (used by OT core).
struct otSrpClientService *mNext; ///< Pointer to next entry in a linked-list (managed by OT core).
uint32_t mLease; ///< Desired lease interval in sec - zero to use default.
uint32_t mKeyLease; ///< Desired key lease interval in sec - zero to use default.
} otSrpClientService;
/**
@@ -270,12 +276,26 @@ void otSrpClientSetCallback(otInstance *aInstance, otSrpClientCallback aCallback
* Config option `OPENTHREAD_CONFIG_SRP_CLIENT_AUTO_START_DEFAULT_MODE` specifies the default auto-start mode (whether
* it is enabled or disabled at the start of OT stack).
*
* When auto-start is enabled, the SRP client will monitor the Thread Network Data for SRP Server Service entries
* and automatically start and stop the client when an SRP server is detected.
* When auto-start is enabled, the SRP client will monitor the Thread Network Data to discover SRP servers and select
* the preferred server and automatically start and stop the client when an SRP server is detected.
*
* If multiple SRP servers are found, a random one will be selected. If the selected SRP server is no longer
* detected (not longer present in the Thread Network Data), the SRP client will be stopped and then it may switch
* to another SRP server (if available).
* There are three categories of Network Data entries indicating presence of SRP sever. They are preferred in the
* following order:
*
* 1) Preferred unicast entries where server address is included in the service data. If there are multiple options,
* the one with numerically lowest IPv6 address is preferred.
*
* 2) Anycast entries each having a seq number. A larger sequence number in the sense specified by Serial Number
* Arithmetic logic in RFC-1982 is considered more recent and therefore preferred. The largest seq number using
* serial number arithmetic is preferred if it is well-defined (i.e., the seq number is larger than all other
* seq numbers). If it is not well-defined, then the numerically largest seq number is preferred.
*
* 3) Unicast entries where the server address info is included in server data. If there are multiple options, the
* one with numerically lowest IPv6 address is preferred.
*
* When there is a change in the Network Data entries, client will check that the currently selected server is still
* present in the Network Data and is still the preferred one. Otherwise the client will switch to the new preferred
* server or stop if there is none.
*
* When the SRP client is explicitly started through a successful call to `otSrpClientStart()`, the given SRP server
* address in `otSrpClientStart()` will continue to be used regardless of the state of auto-start mode and whether the
@@ -345,7 +365,9 @@ uint32_t otSrpClientGetTtl(otInstance *aInstance);
void otSrpClientSetTtl(otInstance *aInstance, uint32_t aTtl);
/**
* This function gets the lease interval used in SRP update requests.
* This function gets the default lease interval used in SRP update requests.
*
* The default interval is used only for `otSrpClientService` instances with `mLease` set to zero.
*
* Note that this is the lease duration requested by the SRP client. The server may choose to accept a different lease
* interval.
@@ -358,7 +380,9 @@ void otSrpClientSetTtl(otInstance *aInstance, uint32_t aTtl);
uint32_t otSrpClientGetLeaseInterval(otInstance *aInstance);
/**
* This function sets the lease interval used in SRP update requests.
* This function sets the default lease interval used in SRP update requests.
*
* The default interval is used only for `otSrpClientService` instances with `mLease` set to zero.
*
* Changing the lease interval does not impact the accepted lease interval of already registered services/host-info.
* It only affects any future SRP update messages (i.e., adding new services and/or refreshes of the existing services).
@@ -371,7 +395,9 @@ uint32_t otSrpClientGetLeaseInterval(otInstance *aInstance);
void otSrpClientSetLeaseInterval(otInstance *aInstance, uint32_t aInterval);
/**
* This function gets the key lease interval used in SRP update requests.
* This function gets the default key lease interval used in SRP update requests.
*
* The default interval is used only for `otSrpClientService` instances with `mKeyLease` set to zero.
*
* Note that this is the lease duration requested by the SRP client. The server may choose to accept a different lease
* interval.
@@ -384,7 +410,9 @@ void otSrpClientSetLeaseInterval(otInstance *aInstance, uint32_t aInterval);
uint32_t otSrpClientGetKeyLeaseInterval(otInstance *aInstance);
/**
* This function sets the key lease interval used in SRP update requests.
* This function sets the default key lease interval used in SRP update requests.
*
* The default interval is used only for `otSrpClientService` instances with `mKeyLease` set to zero.
*
* Changing the lease interval does not impact the accepted lease interval of already registered services/host-info.
* It only affects any future SRP update messages (i.e., adding new services and/or refreshes of existing services).
+40 -3
View File
@@ -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.
*
+2 -2
View File
@@ -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.
+18 -7
View File
@@ -88,10 +88,10 @@ extern "C" {
*/
typedef struct otTcpCircularSendBuffer
{
const uint8_t *mDataBuffer; ///< Pointer to data in the circular send buffer
size_t mCapacity; ///< Length of the circular send buffer
size_t mStartIndex; ///< Index of the first valid byte in the send buffer
size_t mCapacityUsed; ///< Number of bytes stored in the send buffer
uint8_t *mDataBuffer; ///< Pointer to data in the circular send buffer
size_t mCapacity; ///< Length of the circular send buffer
size_t mStartIndex; ///< Index of the first valid byte in the send buffer
size_t mCapacityUsed; ///< Number of bytes stored in the send buffer
otLinkedBuffer mSendLinks[2];
uint8_t mFirstSendLinkIndex;
@@ -107,6 +107,15 @@ typedef struct otTcpCircularSendBuffer
*/
void otTcpCircularSendBufferInitialize(otTcpCircularSendBuffer *aSendBuffer, void *aDataBuffer, size_t aCapacity);
/**
* This enumeration defines flags passed to @p otTcpCircularSendBufferWrite.
*
*/
enum
{
OT_TCP_CIRCULAR_SEND_BUFFER_WRITE_MORE_TO_COME = 1 << 0,
};
/**
* Sends out data on a TCP endpoint, using the provided TCP circular send
* buffer to manage buffering.
@@ -136,15 +145,17 @@ void otTcpCircularSendBufferInitialize(otTcpCircularSendBuffer *aSendBuffer, voi
* @param[in] aLength The length of the data pointed to by @p aData to copy into the TCP circular send buffer.
* @param[out] aWritten Populated with the amount of data copied into the send buffer, which might be less than
* @p aLength if the send buffer reaches capacity.
* @param[in] aFlags Flags specifying options for this operation (see enumeration above).
*
* @returns OT_ERROR_NONE Successfully copied data into the send buffer and sent it on the TCP endpoint.
* @returns OT_ERROR_FAILED Failed to send out data on the TCP endpoint.
*/
otError otTcpCircularSendBufferWrite(otTcpEndpoint * aEndpoint,
otTcpCircularSendBuffer *aSendBuffer,
void * aData,
const void * aData,
size_t aLength,
size_t * aWritten);
size_t * aWritten,
uint32_t aFlags);
/**
* Performs circular-send-buffer-specific handling in the otTcpForwardProgress
@@ -175,7 +186,7 @@ void otTcpCircularSendBufferHandleForwardProgress(otTcpCircularSendBuffer *aSend
*
* @return The amount of free space in the send buffer.
*/
size_t otTcpCircularSendBufferFreeSpace(otTcpCircularSendBuffer *aSendBuffer);
size_t otTcpCircularSendBufferGetFreeSpace(const otTcpCircularSendBuffer *aSendBuffer);
/**
* Forcibly discards all data in the circular send buffer.
+64 -29
View File
@@ -138,6 +138,14 @@ typedef struct
uint8_t mAge; ///< Time last heard
bool mAllocated : 1; ///< Router ID allocated or not
bool mLinkEstablished : 1; ///< Link established with Router ID or not
uint8_t mVersion; ///< Thread version
/**
* Parent CSL parameters are only relevant when OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE is enabled.
*
*/
uint8_t mCslClockAccuracy; ///< CSL clock accuracy, in ± ppm
uint8_t mCslUncertainty; ///< CSL uncertainty, in ±10 us
} otRouterInfo;
/**
@@ -167,6 +175,19 @@ typedef struct otMleCounters
uint16_t mPartitionIdChanges; ///< Number of changes to partition ID.
uint16_t mBetterPartitionAttachAttempts; ///< Number of attempts to attach to a better partition.
/**
* Role time tracking.
*
* When uptime feature is enabled (OPENTHREAD_CONFIG_UPTIME_ENABLE = 1) time spent in each MLE role is tracked.
*
*/
uint64_t mDisabledTime; ///< Number of milliseconds device has been in OT_DEVICE_ROLE_DISABLED role.
uint64_t mDetachedTime; ///< Number of milliseconds device has been in OT_DEVICE_ROLE_DETACHED role.
uint64_t mChildTime; ///< Number of milliseconds device has been in OT_DEVICE_ROLE_CHILD role.
uint64_t mRouterTime; ///< Number of milliseconds device has been in OT_DEVICE_ROLE_ROUTER role.
uint64_t mLeaderTime; ///< Number of milliseconds device has been in OT_DEVICE_ROLE_LEADER role.
uint64_t mTrackedTime; ///< Number of milliseconds tracked by previous counters.
/**
* Number of times device changed its parent.
*
@@ -297,7 +318,7 @@ otError otThreadSetJoinerAdvertisement(otInstance * aInstance,
#define OT_JOINER_ADVDATA_MAX_LENGTH 64 ///< Maximum AdvData Length of Joiner Advertisement
/**
* Get the Thread Child Timeout used when operating in the Child role.
* Gets the Thread Child Timeout (in seconds) used when operating in the Child role.
*
* @param[in] aInstance A pointer to an OpenThread instance.
*
@@ -309,7 +330,7 @@ otError otThreadSetJoinerAdvertisement(otInstance * aInstance,
uint32_t otThreadGetChildTimeout(otInstance *aInstance);
/**
* Set the Thread Child Timeout used when operating in the Child role.
* Sets the Thread Child Timeout (in seconds) used when operating in the Child role.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in] aTimeout The timeout value in seconds.
@@ -320,7 +341,7 @@ uint32_t otThreadGetChildTimeout(otInstance *aInstance);
void otThreadSetChildTimeout(otInstance *aInstance, uint32_t aTimeout);
/**
* Get the IEEE 802.15.4 Extended PAN ID.
* Gets the IEEE 802.15.4 Extended PAN ID.
*
* @param[in] aInstance A pointer to an OpenThread instance.
*
@@ -332,9 +353,9 @@ void otThreadSetChildTimeout(otInstance *aInstance, uint32_t aTimeout);
const otExtendedPanId *otThreadGetExtendedPanId(otInstance *aInstance);
/**
* Set the IEEE 802.15.4 Extended PAN ID.
* Sets the IEEE 802.15.4 Extended PAN ID.
*
* This function can only be called while Thread protocols are disabled. A successful
* @note Can only be called while Thread protocols are disabled. A successful
* call to this function invalidates the Active and Pending Operational Datasets in
* non-volatile memory.
*
@@ -451,7 +472,7 @@ otError otThreadSetNetworkKey(otInstance *aInstance, const otNetworkKey *aKey);
otError otThreadSetNetworkKeyRef(otInstance *aInstance, otNetworkKeyRef aKeyRef);
/**
* This function returns a pointer to the Thread Routing Locator (RLOC) address.
* Gets the Thread Routing Locator (RLOC) address.
*
* @param[in] aInstance A pointer to an OpenThread instance.
*
@@ -461,7 +482,7 @@ otError otThreadSetNetworkKeyRef(otInstance *aInstance, otNetworkKeyRef aKeyRef)
const otIp6Address *otThreadGetRloc(otInstance *aInstance);
/**
* This function returns a pointer to the Mesh Local EID address.
* Gets the Mesh Local EID address.
*
* @param[in] aInstance A pointer to an OpenThread instance.
*
@@ -497,7 +518,7 @@ const otMeshLocalPrefix *otThreadGetMeshLocalPrefix(otInstance *aInstance);
otError otThreadSetMeshLocalPrefix(otInstance *aInstance, const otMeshLocalPrefix *aMeshLocalPrefix);
/**
* This function returns the Thread link-local IPv6 address.
* Gets the Thread link-local IPv6 address.
*
* The Thread link local address is derived using IEEE802.15.4 Extended Address as Interface Identifier.
*
@@ -509,9 +530,9 @@ otError otThreadSetMeshLocalPrefix(otInstance *aInstance, const otMeshLocalPrefi
const otIp6Address *otThreadGetLinkLocalIp6Address(otInstance *aInstance);
/**
* This function returns the Thread Link-Local All Thread Nodes multicast address.
* Gets the Thread Link-Local All Thread Nodes multicast address.
*
* The address is a link-local Unicast Prefix-Based Multcast Address [RFC 3306], with:
* The address is a link-local Unicast Prefix-Based Multicast Address [RFC 3306], with:
* - flgs set to 3 (P = 1 and T = 1)
* - scop set to 2
* - plen set to 64
@@ -526,9 +547,9 @@ const otIp6Address *otThreadGetLinkLocalIp6Address(otInstance *aInstance);
const otIp6Address *otThreadGetLinkLocalAllThreadNodesMulticastAddress(otInstance *aInstance);
/**
* This function returns the Thread Realm-Local All Thread Nodes multicast address.
* Gets the Thread Realm-Local All Thread Nodes multicast address.
*
* The address is a realm-local Unicast Prefix-Based Multcast Address [RFC 3306], with:
* The address is a realm-local Unicast Prefix-Based Multicast Address [RFC 3306], with:
* - flgs set to 3 (P = 1 and T = 1)
* - scop set to 3
* - plen set to 64
@@ -585,9 +606,9 @@ const char *otThreadGetNetworkName(otInstance *aInstance);
otError otThreadSetNetworkName(otInstance *aInstance, const char *aNetworkName);
/**
* Get the Thread Domain Name.
* Gets the Thread Domain Name.
*
* This function is only available since Thread 1.2.
* @note Available since Thread 1.2.
*
* @param[in] aInstance A pointer to an OpenThread instance.
*
@@ -599,10 +620,9 @@ otError otThreadSetNetworkName(otInstance *aInstance, const char *aNetworkName);
const char *otThreadGetDomainName(otInstance *aInstance);
/**
* Set the Thread Domain Name.
* Sets the Thread Domain Name. Only succeeds when Thread protocols are disabled.
*
* This function is only available since Thread 1.2.
* This function succeeds only when Thread protocols are disabled.
* @note Available since Thread 1.2.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in] aDomainName A pointer to the Thread Domain Name.
@@ -616,9 +636,11 @@ const char *otThreadGetDomainName(otInstance *aInstance);
otError otThreadSetDomainName(otInstance *aInstance, const char *aDomainName);
/**
* Set/Clear the Interface Identifier manually specified for the Thread Domain Unicast Address.
* Sets or clears the Interface Identifier manually specified for the Thread Domain Unicast Address.
*
* This function is only available since Thread 1.2 when `OPENTHREAD_CONFIG_DUA_ENABLE` is enabled.
* Available when `OPENTHREAD_CONFIG_DUA_ENABLE` is enabled.
*
* @note Only available since Thread 1.2.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in] aIid A pointer to the Interface Identifier to set or NULL to clear.
@@ -631,9 +653,11 @@ otError otThreadSetDomainName(otInstance *aInstance, const char *aDomainName);
otError otThreadSetFixedDuaInterfaceIdentifier(otInstance *aInstance, const otIp6InterfaceIdentifier *aIid);
/**
* Get the Interface Identifier manually specified for the Thread Domain Unicast Address.
* Gets the Interface Identifier manually specified for the Thread Domain Unicast Address.
*
* This function is only available since Thread 1.2 when `OPENTHREAD_CONFIG_DUA_ENABLE` is enabled.
* Available when `OPENTHREAD_CONFIG_DUA_ENABLE` is enabled.
*
* @note Only available since Thread 1.2.
*
* @param[in] aInstance A pointer to an OpenThread instance.
*
@@ -645,7 +669,7 @@ otError otThreadSetFixedDuaInterfaceIdentifier(otInstance *aInstance, const otIp
const otIp6InterfaceIdentifier *otThreadGetFixedDuaInterfaceIdentifier(otInstance *aInstance);
/**
* Get the thrKeySequenceCounter.
* Gets the thrKeySequenceCounter.
*
* @param[in] aInstance A pointer to an OpenThread instance.
*
@@ -657,7 +681,7 @@ const otIp6InterfaceIdentifier *otThreadGetFixedDuaInterfaceIdentifier(otInstanc
uint32_t otThreadGetKeySequenceCounter(otInstance *aInstance);
/**
* Set the thrKeySequenceCounter.
* Sets the thrKeySequenceCounter.
*
* @note This API is reserved for testing and demo purposes only. Changing settings with
* this API will render a production application non-compliant with the Thread Specification.
@@ -671,7 +695,7 @@ uint32_t otThreadGetKeySequenceCounter(otInstance *aInstance);
void otThreadSetKeySequenceCounter(otInstance *aInstance, uint32_t aKeySequenceCounter);
/**
* Get the thrKeySwitchGuardTime
* Gets the thrKeySwitchGuardTime (in hours).
*
* @param[in] aInstance A pointer to an OpenThread instance.
*
@@ -683,7 +707,7 @@ void otThreadSetKeySequenceCounter(otInstance *aInstance, uint32_t aKeySequenceC
uint32_t otThreadGetKeySwitchGuardTime(otInstance *aInstance);
/**
* Set the thrKeySwitchGuardTime
* Sets the thrKeySwitchGuardTime (in hours).
*
* @note This API is reserved for testing and demo purposes only. Changing settings with
* this API will render a production application non-compliant with the Thread Specification.
@@ -845,7 +869,18 @@ otError otThreadGetParentAverageRssi(otInstance *aInstance, int8_t *aParentRssi)
otError otThreadGetParentLastRssi(otInstance *aInstance, int8_t *aLastRssi);
/**
* Get the IPv6 counters.
* Starts the process for child to search for a better parent while staying attached to its current parent.
*
* Must be used when device is attached as a child.
*
* @retval OT_ERROR_NONE Successfully started the process to search for a better parent.
* @retval OT_ERROR_INVALID_STATE Device role is not child.
*
*/
otError otThreadSearchForBetterParent(otInstance *aInstance);
/**
* Gets the IPv6 counters.
*
* @param[in] aInstance A pointer to an OpenThread instance.
*
@@ -855,7 +890,7 @@ otError otThreadGetParentLastRssi(otInstance *aInstance, int8_t *aLastRssi);
const otIpCounters *otThreadGetIp6Counters(otInstance *aInstance);
/**
* Reset the IPv6 counters.
* Resets the IPv6 counters.
*
* @param[in] aInstance A pointer to an OpenThread instance.
*
@@ -863,7 +898,7 @@ const otIpCounters *otThreadGetIp6Counters(otInstance *aInstance);
void otThreadResetIp6Counters(otInstance *aInstance);
/**
* Get the Thread MLE counters.
* Gets the Thread MLE counters.
*
* @param[in] aInstance A pointer to an OpenThread instance.
*
@@ -873,7 +908,7 @@ void otThreadResetIp6Counters(otInstance *aInstance);
const otMleCounters *otThreadGetMleCounters(otInstance *aInstance);
/**
* Reset the Thread MLE counters.
* Resets the Thread MLE counters.
*
* @param[in] aInstance A pointer to an OpenThread instance.
*
+15 -11
View File
@@ -122,7 +122,7 @@ typedef struct otCacheEntryIterator
} otCacheEntryIterator;
/**
* Get the maximum number of children currently allowed.
* Gets the maximum number of children currently allowed.
*
* @param[in] aInstance A pointer to an OpenThread instance.
*
@@ -134,7 +134,7 @@ typedef struct otCacheEntryIterator
uint16_t otThreadGetMaxAllowedChildren(otInstance *aInstance);
/**
* Set the maximum number of children currently allowed.
* Sets the maximum number of children currently allowed.
*
* This parameter can only be set when Thread protocol operation has been stopped.
*
@@ -196,7 +196,7 @@ otError otThreadSetRouterEligible(otInstance *aInstance, bool aEligible);
otError otThreadSetPreferredRouterId(otInstance *aInstance, uint8_t aRouterId);
/**
* Get the Thread Leader Weight used when operating in the Leader role.
* Gets the Thread Leader Weight used when operating in the Leader role.
*
* @param[in] aInstance A pointer to an OpenThread instance.
*
@@ -208,7 +208,7 @@ otError otThreadSetPreferredRouterId(otInstance *aInstance, uint8_t aRouterId);
uint8_t otThreadGetLocalLeaderWeight(otInstance *aInstance);
/**
* Set the Thread Leader Weight used when operating in the Leader role.
* Sets the Thread Leader Weight used when operating in the Leader role.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in] aWeight The Thread Leader Weight value.
@@ -238,7 +238,7 @@ uint32_t otThreadGetPreferredLeaderPartitionId(otInstance *aInstance);
void otThreadSetPreferredLeaderPartitionId(otInstance *aInstance, uint32_t aPartitionId);
/**
* Get the Joiner UDP Port.
* Gets the Joiner UDP Port.
*
* @param[in] aInstance A pointer to an OpenThread instance.
*
@@ -250,7 +250,7 @@ void otThreadSetPreferredLeaderPartitionId(otInstance *aInstance, uint32_t aPart
uint16_t otThreadGetJoinerUdpPort(otInstance *aInstance);
/**
* Set the Joiner UDP Port.
* Sets the Joiner UDP Port.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in] aJoinerUdpPort The Joiner UDP Port number.
@@ -451,7 +451,7 @@ uint8_t otThreadGetRouterSelectionJitter(otInstance *aInstance);
void otThreadSetRouterSelectionJitter(otInstance *aInstance, uint8_t aRouterJitter);
/**
* The function retains diagnostic information for an attached Child by its Child ID or RLOC16.
* Gets diagnostic information for an attached Child by its Child ID or RLOC16.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in] aChildId The Child ID or RLOC16 for the attached child.
@@ -645,7 +645,7 @@ int8_t otThreadGetParentPriority(otInstance *aInstance);
otError otThreadSetParentPriority(otInstance *aInstance, int8_t aParentPriority);
/**
* This function gets the maximum number of IP addresses that each MTD child may register with this device as parent.
* Gets the maximum number of IP addresses that each MTD child may register with this device as parent.
*
* @param[in] aInstance A pointer to an OpenThread instance.
*
@@ -657,11 +657,15 @@ otError otThreadSetParentPriority(otInstance *aInstance, int8_t aParentPriority)
uint8_t otThreadGetMaxChildIpAddresses(otInstance *aInstance);
/**
* This function sets/restores the maximum number of IP addresses that each MTD child may register with this
* Sets or restores the maximum number of IP addresses that each MTD child may register with this
* device as parent.
*
* @note This API requires `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE`, and is only used by Thread Test Harness
* to limit the address registrations of the reference parent in order to test the MTD DUT reaction.
* Pass `0` to clear the setting and restore the default.
*
* Available when `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is enabled.
*
* @note Only used by Thread Test Harness to limit the address registrations of the reference
* parent in order to test the MTD DUT reaction.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in] aMaxIpAddresses The maximum number of IP addresses that each MTD child may register with this
+1 -1
View File
@@ -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
+1 -2
View File
@@ -55,8 +55,7 @@ check_datetime()
EOF
OPENTHREAD_PROJECT_CFLAGS="-I$PWD -DOPENTHREAD_CONFIG_FILE=\\\"openthread-config-datetime.h\\\" \
-DOPENTHREAD_PROJECT_CORE_CONFIG_FILE=\\\"openthread-core-posix-config.h\\\" \
-std=c99" \
-DOPENTHREAD_PROJECT_CORE_CONFIG_FILE=\\\"openthread-core-posix-config.h\\\"" \
make showcommands ot-cli
grep "$datetime" -ao "out/target/product/generic/system/bin/ot-cli"
make clean-ot-cli
+69 -2
View File
@@ -29,10 +29,77 @@
set -euxo pipefail
readonly OT_TMP_DIR=/tmp/ot-arm-build-cmake
readonly OT_SHA_NEW=${GITHUB_SHA:-$(git rev-parse HEAD)}
build_nrf52840()
{
local options=(
"-DOT_ANYCAST_LOCATOR=ON"
"-DOT_BACKBONE_ROUTER=ON"
"-DOT_BORDER_AGENT=ON"
"-DOT_BORDER_ROUTER=ON"
"-DOT_CHANNEL_MANAGER=ON"
"-DOT_CHANNEL_MONITOR=ON"
"-DOT_CHILD_SUPERVISION=ON"
"-DOT_COAP=ON"
"-DOT_COAPS=ON"
"-DOT_COMMISSIONER=ON"
"-DOT_CSL_RECEIVER=ON"
"-DOT_DATASET_UPDATER=ON"
"-DOT_DHCP6_CLIENT=ON"
"-DOT_DHCP6_SERVER=ON"
"-DOT_DIAGNOSTIC=ON"
"-DOT_DNSSD_SERVER=ON"
"-DOT_DNS_CLIENT=ON"
"-DOT_DUA=ON"
"-DOT_ECDSA=ON"
"-DOT_FULL_LOGS=ON"
"-DOT_JAM_DETECTION=ON"
"-DOT_JOINER=ON"
"-DOT_LINK_METRICS_INITIATOR=ON"
"-DOT_LINK_METRICS_SUBJECT=ON"
"-DOT_LINK_RAW=ON"
"-DOT_MAC_FILTER=ON"
"-DOT_MESSAGE_USE_HEAP=ON"
"-DOT_MLR=ON"
"-DOT_MTD_NETDIAG=ON"
"-DOT_NETDATA_PUBLISHER=ON"
"-DOT_PING_SENDER=ON"
"-DOT_SERVICE=ON"
"-DOT_SLAAC=ON"
"-DOT_SNTP_CLIENT=ON"
"-DOT_SRP_CLIENT=ON"
"-DOT_SRP_SERVER=ON"
"-DOT_THREAD_VERSION=1.3"
"-DOT_TIME_SYNC=ON"
"-DOT_UDP_FORWARD=ON"
"-DOT_UPTIME=ON"
)
rm -rf "${OT_TMP_DIR}"
script/git-tool clone https://github.com/openthread/ot-nrf528xx.git "${OT_TMP_DIR}"
rm -rf "${OT_TMP_DIR}/openthread/*"
git archive "${OT_SHA_NEW}" | tar x -C "${OT_TMP_DIR}/openthread"
cd "${OT_TMP_DIR}"
script/build nrf52840 UART_trans "${options[@]}"
}
main()
{
"$(dirname "$0")"/check-arm-build-autotools
"$(dirname "$0")"/check-arm-build-cmake
export CPPFLAGS="${CPPFLAGS:-} -DNDEBUG"
if [[ $# == 0 ]]; then
build_nrf52840
return 0
fi
while [[ $# != 0 ]]; do
"build_$1"
shift
done
}
main "$@"

Some files were not shown because too many files have changed in this diff Show More