Skip to content

Commit

Permalink
[spinel] Make 'kTxWaitUs' configurable during compile time.
Browse files Browse the repository at this point in the history
It is useful in case RCP needs to wait for longer than the hardcoded value in kTxWaitUs.
  • Loading branch information
parag-silabs committed Dec 5, 2023
1 parent 3754174 commit a626ea6
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 2 deletions.
2 changes: 2 additions & 0 deletions etc/cmake/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,8 @@ ot_int_option(OT_RCP_RESTORATION_MAX_COUNT OPENTHREAD_SPINEL_CONFIG_RCP_RESTORAT

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

ot_int_option(OT_RCP_TX_WAIT_TIME_SECS OPENTHREAD_SPINEL_CONFIG_RCP_TX_WAIT_TIME_SECS "set RCP TX wait TIME in seconds")

if(NOT OT_EXTERNAL_MBEDTLS)
set(OT_MBEDTLS mbedtls)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS=1")
Expand Down
1 change: 1 addition & 0 deletions script/check-scan-build
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ OT_BUILD_OPTIONS=(
"-DOT_PING_SENDER=ON"
"-DOT_PLATFORM=external"
"-DOT_RCP_RESTORATION_MAX_COUNT=2"
"-DOT_RCP_TX_WAIT_TIME_SECS=5"
"-DOT_REFERENCE_DEVICE=ON"
"-DOT_SERVICE=ON"
"-DOT_SLAAC=ON"
Expand Down
1 change: 1 addition & 0 deletions script/cmake-build
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ OT_POSIX_SIM_COMMON_OPTIONS=(
"-DOT_SNTP_CLIENT=ON"
"-DOT_SRP_CLIENT=ON"
"-DOT_SRP_SERVER=ON"
"-DOT_RCP_TX_WAIT_TIME_SECS=5"
"-DOT_UPTIME=ON"
)
readonly OT_POSIX_SIM_COMMON_OPTIONS
Expand Down
10 changes: 10 additions & 0 deletions src/lib/spinel/openthread-spinel-config.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,14 @@
#define OPENTHREAD_SPINEL_CONFIG_VENDOR_HOOK_HEADER "lib/spinel/example_vendor_hook.hpp"
#endif

/**
* @def OPENTHREAD_SPINEL_CONFIG_RCP_TX_WAIT_TIME_SECS
*
* Defines the Tx wait duration in seconds.
*
*/
#ifndef OPENTHREAD_SPINEL_CONFIG_RCP_TX_WAIT_TIME_SECS
#define OPENTHREAD_SPINEL_CONFIG_RCP_TX_WAIT_TIME_SECS 5
#endif

#endif // OPENTHREAD_SPINEL_CONFIG_H_
7 changes: 5 additions & 2 deletions src/lib/spinel/radio_spinel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1105,9 +1105,12 @@ class RadioSpinel
kStateTransmitDone, ///< Radio indicated frame transmission is done.
};

static constexpr uint32_t kUsPerMs = 1000; ///< Microseconds per millisecond.
static constexpr uint32_t kUsPerMs = 1000; ///< Microseconds per millisecond.
static constexpr uint32_t kMsPerSec = 1000; ///< Milliseconds per second.
static constexpr uint32_t kUsPerSec = kUsPerMs * kMsPerSec; ///< Microseconds per second.
static constexpr uint64_t kTxWaitUs =
5000000; ///< Maximum time of waiting for `TransmitDone` event, in microseconds.
OPENTHREAD_SPINEL_CONFIG_RCP_TX_WAIT_TIME_SECS *
kUsPerSec; ///< Maximum time of waiting for `TransmitDone` event, in microseconds.

typedef otError (RadioSpinel::*ResponseHandler)(const uint8_t *aBuffer, uint16_t aLength);

Expand Down

0 comments on commit a626ea6

Please sign in to comment.