mirror of
https://github.com/espressif/openthread.git
synced 2026-08-12 21:57:47 +00:00
[rcp] add enable-coex switch (#7675)
This commit adds a new option of radio url to enable/disable RCP coex feature on boot without changing the RCP firmware.
This commit is contained in:
@@ -166,6 +166,15 @@ void Radio::Init(void)
|
||||
VerifyOrDie(str == nullptr, OT_EXIT_INVALID_ARGUMENTS);
|
||||
}
|
||||
#endif // OPENTHREAD_POSIX_CONFIG_MAX_POWER_TABLE_ENABLE
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE
|
||||
{
|
||||
const char *enableCoex = mRadioUrl.GetValue("enable-coex");
|
||||
if (enableCoex != nullptr)
|
||||
{
|
||||
SuccessOrDie(sRadioSpinel.SetCoexEnabled(enableCoex[0] != '0'));
|
||||
}
|
||||
}
|
||||
#endif // OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE
|
||||
}
|
||||
|
||||
} // namespace Posix
|
||||
|
||||
@@ -91,6 +91,8 @@ const char *otSysGetRadioUrlHelpString(void)
|
||||
return "RadioURL:\n" OT_RADIO_URL_HELP_BUS OT_RADIO_URL_HELP_MAX_POWER_TABLE
|
||||
" region[=region-code] Set the radio's region code.\n"
|
||||
" cca-threshold[=dbm] Set the radio's CCA ED threshold in dBm measured at antenna connector.\n"
|
||||
" enable-coex[=1|0] If not specified, RCP coex operates with its default configuration.\n"
|
||||
" Disable coex with 0, and enable it with other values.\n"
|
||||
" fem-lnagain[=dbm] Set the Rx LNA gain in dBm of the external FEM.\n"
|
||||
" ncp-dataset Retrieve dataset from ncp.\n"
|
||||
" no-reset Do not send Spinel reset command to RCP on initialization.\n"
|
||||
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/expect -f
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
source "tests/scripts/expect/_common.exp"
|
||||
|
||||
spawn_node 1 "rcp" "spinel+hdlc+uart://$env(OT_SIMULATION_APPS)/ncp/ot-rcp?enable-coex&forkpty-arg=1"
|
||||
send "coex\n"
|
||||
expect_line "Enabled"
|
||||
expect_line "Done"
|
||||
dispose_node 1
|
||||
|
||||
spawn_node 1 "rcp" "spinel+hdlc+uart://$env(OT_SIMULATION_APPS)/ncp/ot-rcp?enable-coex=0&forkpty-arg=1"
|
||||
send "coex\n"
|
||||
expect_line "Disabled"
|
||||
expect_line "Done"
|
||||
dispose_node 1
|
||||
Reference in New Issue
Block a user