Commit Graph

32 Commits

Author SHA1 Message Date
Jonathan Hui aaaae937d3 [style] prefer OT_UNUSED_VARIABLE (#3696) 2019-03-19 21:17:33 -07:00
Yakun Xu e68e86317e [ci] test with time sync and header ie (#3514)
This commit adds the missing test with ie present by enabling TIME_SYNC
feature, so that IE code are covered.
2019-02-01 16:08:43 -08:00
Jonathan Hui 69d98d4a53 [code-style] apply clang-format 2018-02-09 21:43:42 +00:00
Jonathan Hui 741941e271 [radio] remove transmit power config from core (#2352)
Thread (and OpenThread) does not employ any form of transmit power control.
As a result, while OpenThread provides APIs to control transmit power, it
simply buffers and passes the transmit power value straight through to the
radio.

Currently, the transmit power APIs allow specifying an int8_t in units of
dBm.  This is overly constraining for platforms that have more advanced ways
of configuring the transmit power.

This commit removes the transmit power configuration from the core.  This
provides better flexibility in platform-specific ways to configure transmit
power.
2017-11-28 17:33:32 +00:00
Abtin Keshavarzian 02c876ef62 [instance] define ot::Instance class (#2307)
This commit makes the following changes: It defines the public
`otInstance` as an empty opaque structure which is used by all public
C OpenThread APIs. It defines a new class `ot::Instance` (inheriting
from `otInstance) which is then used in core source files. The
functionality related to the instance is also moved/added into the
newly added `Instance` class (as class/static or member methods).
2017-11-13 08:27:57 -08:00
Shu Chen 588613ba65 [posix] add microsecond timer support (#2086) 2017-08-10 10:08:17 -07:00
Jonathan Hui 5d7a03334f [radio] unify around otExtAddress type (#2029) 2017-07-28 08:05:06 -07:00
Abtin Keshavarzian fc72e4e719 [instance-locator] use instance reference instead of pointer (#2007)
This commit changes the `InstanceLocator` class to keep track of a
reference to `otInstance` (instead of a pointer) to make it behave
similar to other `ObjectLocator` classes. The method `GetInstance()`
in all locator objects is updated to provide a reference (instead
of a pointer) to `otInstance`.

The logging macros are updated such that a reference to `otInstance`
is passed as the first argument (with the exception of
`otLog<Level>Plat()` macros which are used by platform code in C
domain). The documentation for log macros are also updated.
2017-07-25 15:06:14 -07:00
Shu Chen 129c419107 [timer] multiple microseconds timer support (#1962)
* [timer] multiple microseconds timer support

* Remove TimerSchedulerLocator, Timer inherit from Ip6Locator instead to get TimerScheduler.

* Add separate UsecTimer and UsecTimerScheduler for multiple microseconds timer support.

* [timer] refine Timer names

* Rename alarm header files to alarm-milli.h and alarm-micro.h

* Rename alarm APIs to start with otPlatAlarmMilli and otPlatAlarmMicro

* Rename Timer classes to TimerMilli/TimerMilliScheduler and TimerMicro/TimerMicroScheduler

* [Timer] Refactor Timer code structure

* Create TimerBase and TimerSchedulerBase class for common functions;

* Use TimerMilli/TimerMicro and TimerMilliScheduler/TimerMicroScheduler for different functions;

* Define AlarmApi, so then TimerMilliScheduler/TimerMicroScheduler could use different AlarmApi.
2017-07-10 16:01:27 -07:00
Shu Chen 93f892bdbe [tests] Fix some unit tests random fail issue (#1966) 2017-07-07 06:40:07 -07:00
Abtin Keshavarzian bbab3074ed [instance] single OpenThread instance optimizations (#1926)
This commit new configuration option `enable-multiple-instances` and
its corresponding option `OPENTHREAD_ENABLE_MULTIPLE_INSTANCES`. When
enabled OpenThread supports handling of multiple instances. By default
this is disabled.

This commit also adds two optimizations for single instance case to
simplify the code and also help reduce memory/RAM usage:

(1) OpenThread objects/classes typically keep a reference to a higher
level object (e.g., many classes keep track of owning `ThreadNetif`)
to be able to access other objects/methods within OpenThread class
hierarchy. In single instance mode, the reference member variables are
removed and instead global functions are used to access the singleton
objects from one class to the other. To implement this, a group of
`<Object>Locator` classes are defined (e.g., `ThreadNetifLocator`,
etc.) which are then used as base class of other OpenThread classes.

(2) OpenThread objects which provide a callback/handler (e.g.,
`Timer`, `Tasklet`, etc.) have `void *mContext` member variable which
is used to keep track of the owner of the object. In single instance
mode the `mConext` member variables are removed since the owner is
expected to be a singleton and can be uniquely determined from the
callback function.

To implement this, two changes are made: First the handler methods are
modified to provide a reference to the object (e.g., `Timer` handler
will provide a `Timer &aTimer` as a parameter of its handler
callback). Second, a new base class `Context` is introduced which
hides the implementation providing an arbitrary context information. A
new static method `GetOwner(aContext)` is added to classes which own a
callback providing objects. This method help convert a `Context` to
the reference of the owner class object.
2017-06-30 11:48:26 -07:00
Shu Chen 2de6f35f72 Diag: Refine diag send codes (#1858)
* Diag module should continue to send next packet even if the last transmission failed

* Remove unnecessary aFramePending parameter from diag transmit done callback
2017-06-01 08:58:06 -07:00
Jonathan Hui 48a9a63252 Clean up radio names. (#1837) 2017-05-27 21:27:06 -07:00
Jonathan Hui 9073d0d99a Cleanup reset reason names. (#1824) 2017-05-25 09:08:45 -07:00
Jonathan Hui 48b9299544 Clean up error names. (#1764) 2017-05-23 09:34:35 -07:00
Shu Chen 66f6e7088d Add otPlatRadioGetReceiveSensitivity() API (#1715)
* Add otPlatRadioGetReceiveSensitivity() API

* Add a new otPlatRadioGetReceiveSensitivity() API to get sensitivity value;

* Use the receive sensitivity value as the noise floor for link metric computation;

* Remove some unused noise floor related functions.

* Add SPINEL_PROP_PHY_RX_SENSITIVITY Spinel/NCP property
2017-05-04 20:38:37 -07:00
Jonathan Hui 115b52e6c4 Require platform TRNG to provide requested output length or error. (#1650) 2017-04-25 09:22:53 -07:00
Buke Po 145a3adfc1 fix code style issue make pretty founds. (#1622) 2017-04-19 21:35:25 -07:00
pvanhorn 04caca7cc8 Implement the use of otPlatRadioDefaultTxPower API. (#1417)
* Implement the use of otPlatRadioDefaultTxPower API.

* Add implementation of otPlatRadioSetDefaultTxPower for windows.
2017-03-03 11:09:33 -08:00
Jonathan Hui 77bc491c56 Tasklet API cleanup. 2017-03-02 10:24:55 -08:00
Jorge Vergara f3817e76cf Enable mbedTLS dynamic memory allocation in user mode on Windows (#1373)
* change user mode openthread to enable dynamic memory allocation in mbedtls

* complete merge by adding OPENTHREAD_MULTIPLE_INSTANCE to last file

* remove some extraneous changes that got pulled in accidentally

* fix spacing

* fix crash in existing tests due to this change

* fix x86 build
2017-02-23 22:01:59 -08:00
Nick Banks 53bcbb9012 Add otLinkRaw* API (#1181) 2017-01-24 11:16:32 -08:00
pvanhorn 67dbbfc402 Fix scanning behavior. Change logic around otPlatRadioGetTransmitBuffer. (#942)
* Fix scanning behavior with default channel. Change logic around otPlatRadioGetTransmitBuffer so that the buffer becomes the property of OT post call. The MAC will keep a pointer to the tx buffer and pass it into otPlatRadioTransmit. This change should make the notion of retrying the transmit operation with the same buffer more intuitive.
2016-11-08 12:21:28 -08:00
Nick Banks 82e85a7300 Some Very Simple Fuzz Testing (#901)
* Add initial 'dump' fuzzing for radio receive.
2016-11-04 14:53:07 -07:00
pvanhorn 85fb7a451c Remove otPlatFlash API's and move settings from core to examples. (#889)
* Remove otPlatFlash API's and move settings from core to examples.
2016-10-28 18:42:19 -07:00
Nick Banks 7a19067515 Some Logging Cleanup (#810)
* Remove unnecessary WPP definition.
* Various other small fixes.
2016-10-20 10:30:53 -07:00
Lu Wang 8468ffdb77 Settings Driver (#775)
* Settings Driver
2016-10-16 21:54:10 -07:00
Jonathan Hui 3ebef251eb Radio API: set short address, extended address, and panid must not fail. (#774) 2016-10-08 18:49:23 -07:00
Nick Banks 2df41313a9 Add support for radio energy scan API (#749)
* Add support for radio energy scan API
2016-10-06 23:20:50 -07:00
Nick Banks 79d99e7a91 Refactor OpenThread Global Variables into a Single Context Structure (#357)
* Refactor OpenThread to contain all global/static variables in a single context structure.
2016-10-04 15:23:25 -07:00
rongli add8639049 Support AutoPend for CC2538 (#562) 2016-09-23 11:12:53 -07:00
Nick Banks 25cea9414b Windows Unit Test Support (#629)
Window Unit Test Support
2016-09-20 18:11:19 -07:00