net: openthread: OpenThread RCP mode integration into Zephyr

* Add RCP library.
* Conditionally remove non required libraries not required for RCP.
* Drop :option: marker for CONFIG_OPENTHREAD_NCP_SPINEL_ON_UART_ACM

Signed-off-by: Markus Becker <markus.becker@tridonic.com>
This commit is contained in:
Markus Becker 2020-10-12 16:41:25 +02:00 committed by Carles Cufí
commit 638b5f389f
20 changed files with 183 additions and 172 deletions

View file

@ -576,7 +576,6 @@ Drivers and Sensors
application relies on any of the following Kconfig options, then application relies on any of the following Kconfig options, then
it shall also enable the USB subsystem: it shall also enable the USB subsystem:
* :option:`CONFIG_OPENTHREAD_NCP_SPINEL_ON_UART_ACM`
* :option:`CONFIG_USB_DEVICE_NETWORK_ECM` * :option:`CONFIG_USB_DEVICE_NETWORK_ECM`
* :option:`CONFIG_USB_DEVICE_NETWORK_EEM` * :option:`CONFIG_USB_DEVICE_NETWORK_EEM`
* :option:`CONFIG_USB_DEVICE_NETWORK_RNDIS` * :option:`CONFIG_USB_DEVICE_NETWORK_RNDIS`

View file

@ -0,0 +1,60 @@
.. _coprocessor-sample:
OpenThread Co-Processor
#######################
Overview
********
OpenThread Co-Processor allows building a Thread Border Router. The code in this
sample is only the MCU target part of a complete Thread Border Router.
The Co-Processor can act in two variants: Network Co-Processor (NCP) and Radio
Co-Processor (RCP), see https://openthread.io/platforms/co-processor.
Additional required host-side tools (e.g. otbr-agent) to build a Thread Border
Router can be obtained by following
https://openthread.io/guides/border-router/build#set-up-the-border-router.
The preferred Co-Processor configuration of OpenThread is RCP now.
The source code for this sample application can be found at:
:zephyr_file:`samples/net/openthread/coprocessor`.
Building and Running
********************
Build the OpenThread NCP sample application like this:
.. zephyr-app-commands::
:zephyr-app: samples/net/openthread/coprocessor
:board: <board to use>
:conf: <config file to use>
:goals: build
:compact:
Example building for the nrf52840dk_nrf52840 for RCP:
.. zephyr-app-commands::
:zephyr-app: samples/net/openthread/coprocessor
:host-os: unix
:board: nrf52840dk_nrf52840
:conf: "prj.conf overlay-rcp.conf"
:goals: run
:compact:
There are configuration files for different boards and setups in the
coprocessor directory:
- :file:`prj.conf`
Generic NCP config file. Use this, if you want the NCP configuration.
- :file:`overlay-rcp.conf`
RCP overlay file. Use this in combination with prj.conf, if you want the RCP
configuration.
- :file:`overlay-tri-n4m-br.conf`
This is an overlay for the dedicated Thread Border Router hardware
https://www.tridonic.com/com/en/products/net4more-borderROUTER-PoE-Thread.asp.
The board support is not part of the Zephyr repositories, but the
product is based on NXP K64 and AT86RF233. This file can be used as an
example for a development set-up based on development boards.

View file

@ -0,0 +1,7 @@
# This overlay switches from NCP to RCP, use in combination with prj.conf
CONFIG_OPENTHREAD_COPROCESSOR_NCP=n
CONFIG_OPENTHREAD_COPROCESSOR_RCP=y
CONFIG_NET_PKT_RX_COUNT=8
CONFIG_NET_PKT_TX_COUNT=8

View file

@ -4,17 +4,18 @@ CONFIG_UART_SHELL_ON_DEV_NAME="UART_0"
CONFIG_UART_CONSOLE_ON_DEV_NAME="UART_0" CONFIG_UART_CONSOLE_ON_DEV_NAME="UART_0"
CONFIG_SHELL_PROMPT_UART="ncp-uart:~$ " CONFIG_SHELL_PROMPT_UART="ncp-uart:~$ "
# Use UART_1 for NCP # Use UART_1 for Co-Processor
CONFIG_OPENTHREAD_NCP_SPINEL_ON_UART_DEV_NAME="UART_1" #CONFIG_OPENTHREAD_COPROCESSOR_SPINEL_ON_UART_DEV_NAME="UART_1"
# Use USB-CDC-ACM for NCP # Use USB-CDC-ACM for NCP
CONFIG_OPENTHREAD_NCP_SPINEL_ON_UART_ACM=y CONFIG_OPENTHREAD_COPROCESSOR_SPINEL_ON_UART_ACM=y
CONFIG_OPENTHREAD_NCP_SPINEL_ON_UART_DEV_NAME="CDC_ACM_0" CONFIG_OPENTHREAD_COPROCESSOR_SPINEL_ON_UART_DEV_NAME="CDC_ACM_0"
CONFIG_STDOUT_CONSOLE=y CONFIG_STDOUT_CONSOLE=y
CONFIG_GPIO=y CONFIG_GPIO=y
CONFIG_USB=y CONFIG_USB=y
CONFIG_USB_DEVICE_STACK=y CONFIG_USB_DEVICE_STACK=y
CONFIG_USB_DEVICE_PRODUCT="OpenThread NCP K64" CONFIG_USB_DEVICE_PRODUCT="OpenThread Co-Processor K64"
CONFIG_LOG=y CONFIG_LOG=y
CONFIG_USB_DRIVER_LOG_LEVEL_ERR=y CONFIG_USB_DRIVER_LOG_LEVEL_ERR=y
CONFIG_USB_CDC_ACM=y CONFIG_USB_CDC_ACM=y

View file

@ -5,12 +5,12 @@ CONFIG_UART_SHELL_ON_DEV_NAME="UART_0"
CONFIG_UART_CONSOLE_ON_DEV_NAME="UART_0" CONFIG_UART_CONSOLE_ON_DEV_NAME="UART_0"
CONFIG_SHELL_PROMPT_UART="ncp-uart:~$ " CONFIG_SHELL_PROMPT_UART="ncp-uart:~$ "
# Use USB-CDC-ACM for NCP # Use USB-CDC-ACM for Co-Processor
CONFIG_OPENTHREAD_NCP_SPINEL_ON_UART_ACM=y CONFIG_OPENTHREAD_COPROCESSOR_SPINEL_ON_UART_ACM=y
CONFIG_OPENTHREAD_NCP_SPINEL_ON_UART_DEV_NAME="CDC_ACM_0" CONFIG_OPENTHREAD_COPROCESSOR_SPINEL_ON_UART_DEV_NAME="CDC_ACM_0"
CONFIG_USB=y CONFIG_USB=y
CONFIG_USB_DEVICE_STACK=y CONFIG_USB_DEVICE_STACK=y
CONFIG_USB_DEVICE_PRODUCT="OpenThread NCP NRF" CONFIG_USB_DEVICE_PRODUCT="OpenThread CoProcessor NRF"
CONFIG_USB_CDC_ACM=y CONFIG_USB_CDC_ACM=y
CONFIG_UART_LINE_CTRL=y CONFIG_UART_LINE_CTRL=y
CONFIG_USB_REQUEST_BUFFER_SIZE=2048 CONFIG_USB_REQUEST_BUFFER_SIZE=2048

View file

@ -0,0 +1,38 @@
CONFIG_NETWORKING=y
CONFIG_NET_L2_OPENTHREAD=y
# Disable certain parts of Zephyr IPv6 stack
CONFIG_NET_IPV6_NBR_CACHE=n
CONFIG_NET_IPV6_MLD=n
# Logging
CONFIG_LOG=y
CONFIG_LOG_MAX_LEVEL=1
CONFIG_LOG_MINIMAL=n
CONFIG_LOG_BACKEND_SPINEL=y
CONFIG_LOG_BACKEND_RTT=y
CONFIG_LOG_BACKEND_UART=n
CONFIG_BOOT_BANNER=n
# Kernel options
CONFIG_MAIN_STACK_SIZE=2048
CONFIG_INIT_STACKS=y
# Increase logging thread stack size due to Spinel backend needs
CONFIG_LOG_PROCESS_THREAD_STACK_SIZE=2048
# Set OpenThread NCP architecture
CONFIG_OPENTHREAD_COPROCESSOR=y
CONFIG_OPENTHREAD_COPROCESSOR_NCP=y
# Add features required for NCP
CONFIG_OPENTHREAD_DIAG=y
CONFIG_OPENTHREAD_DHCP6_SERVER=y
CONFIG_OPENTHREAD_COMMISSIONER=y
CONFIG_OPENTHREAD_BORDER_AGENT=y
CONFIG_OPENTHREAD_BORDER_ROUTER=y
CONFIG_OPENTHREAD_UDP_FORWARD=y
CONFIG_OPENTHREAD_ENABLE_SERVICE=y
# Move console to other UART to not interfere with NCP
CONFIG_UART_CONSOLE_ON_DEV_NAME="UART_1"

View file

@ -17,13 +17,13 @@ LOG_MODULE_REGISTER(ot_br, LOG_LEVEL_DBG);
void main(void) void main(void)
{ {
#if defined(CONFIG_OPENTHREAD_NCP_SPINEL_ON_UART_ACM) #if defined(CONFIG_OPENTHREAD_COPROCESSOR_SPINEL_ON_UART_ACM)
const struct device *dev; const struct device *dev;
uint32_t baudrate = 0U; uint32_t baudrate = 0U;
int ret; int ret;
dev = device_get_binding( dev = device_get_binding(
CONFIG_OPENTHREAD_NCP_SPINEL_ON_UART_DEV_NAME); CONFIG_OPENTHREAD_COPROCESSOR_SPINEL_ON_UART_DEV_NAME);
if (!dev) { if (!dev) {
LOG_ERR("UART device not found"); LOG_ERR("UART device not found");
return; return;
@ -44,7 +44,7 @@ void main(void)
} else { } else {
LOG_INF("Baudrate detected: %d", baudrate); LOG_INF("Baudrate detected: %d", baudrate);
} }
#endif /* CONFIG_OPENTHREAD_NCP_SPINEL_ON_UART_ACM */ #endif /* CONFIG_OPENTHREAD_COPROCESSOR_SPINEL_ON_UART_ACM */
LOG_INF(APP_BANNER, CONFIG_NET_SAMPLE_APPLICATION_VERSION); LOG_INF(APP_BANNER, CONFIG_NET_SAMPLE_APPLICATION_VERSION);
} }

View file

@ -1,41 +0,0 @@
.. _ncp-sample:
OpenThread NCP
##############
Overview
********
OpenThread NCP allows building a Thread Border Router. The code in this
sample is only the MCU target part of a complete Thread Border Router.
The Linux tools from https://openthread.io/guides/border-router
(especially wpantund and wpanctl) are required to get a complete Thread
Border Router.
The source code for this sample application can be found at:
:zephyr_file:`samples/net/openthread/ncp`.
Building and Running
********************
Build the OpenThread NCP sample application like this:
.. zephyr-app-commands::
:zephyr-app: samples/net/openthread/ncp
:board: <board to use>
:conf: <config file to use>
:goals: build
:compact:
There are configuration files for different boards and setups in the
ncp directory:
- :file:`prj.conf`
Generic config file, normally you should use this.
- :file:`overlay-tri-n4m-br.conf`
This is an overlay for the dedicated Thread Border Router hardware
https://www.tridonic.com/com/en/products/net4more-borderROUTER-PoE-Thread.asp.
The board support is not part of the Zephyr repositories, but the
product is based on NXP K64 and AT86RF233. This file can be used as an
example for a development set-up based on development boards.

View file

@ -1,69 +0,0 @@
# Generic networking options
CONFIG_NETWORKING=y
CONFIG_NET_CONFIG_NEED_IPV6=y
CONFIG_NET_CONFIG_NEED_IPV4=n
# disable certain parts of Zephyr IPv6 stack
CONFIG_NET_IPV6_NBR_CACHE=n
CONFIG_NET_IPV6_MLD=n
# Kernel options
CONFIG_NEWLIB_LIBC=y
CONFIG_MAIN_STACK_SIZE=4096
CONFIG_TEST_RANDOM_GENERATOR=y
CONFIG_INIT_STACKS=y
#CONFIG_DEBUG_OPTIMIZATIONS=y
# Logging
CONFIG_NET_LOG=y
CONFIG_LOG=y
CONFIG_NET_STATISTICS=y
CONFIG_PRINTK=y
# Network buffers
CONFIG_NET_PKT_RX_COUNT=16
CONFIG_NET_PKT_TX_COUNT=16
CONFIG_NET_BUF_RX_COUNT=80
CONFIG_NET_BUF_TX_COUNT=80
CONFIG_NET_CONTEXT_NET_PKT_POOL=y
# Thread by default registers quite a lot addresses.
CONFIG_NET_MAX_CONTEXTS=10
# Allow monitoring of stacks
# CONFIG_KERNEL_SHELL=y
# mbedTLS tweaks
CONFIG_MBEDTLS_SSL_MAX_CONTENT_LEN=768
# CONFIG_MBEDTLS_DEBUG=y
# CONFIG_MBEDTLS_DEBUG_LEVEL=4
# Enable OpenThread
CONFIG_NET_L2_OPENTHREAD=y
# Configure OpenThread
CONFIG_OPENTHREAD_CHANNEL=26
# Use PANID 0xffff to be able to commission
CONFIG_OPENTHREAD_PANID=65535
# Increase a few stack and other sizes for OpenThread
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
CONFIG_SHELL_STACK_SIZE=3072
CONFIG_OPENTHREAD_THREAD_STACK_SIZE=8192
CONFIG_OPENTHREAD_PKT_LIST_SIZE=20
# Settings for the Border Router
# from https://openthread.io/guides/border-router/build#build-and-flash-ncp
# CONFIG_OPENTHREAD_DHCP6_CLIENT is not set
CONFIG_OPENTHREAD_DHCP6_SERVER=y
CONFIG_OPENTHREAD_COMMISSIONER=y
CONFIG_OPENTHREAD_BORDER_AGENT=y
CONFIG_OPENTHREAD_BORDER_ROUTER=y
CONFIG_OPENTHREAD_UDP_FORWARD=y
CONFIG_OPENTHREAD_NCP=y
CONFIG_OPENTHREAD_ENABLE_SERVICE=y
# OpenThread shell interferes with Zephyr shell
CONFIG_OPENTHREAD_SHELL=n

View file

@ -427,7 +427,7 @@ endif # LOG_BACKEND_RTT
config LOG_BACKEND_SPINEL config LOG_BACKEND_SPINEL
bool "Enable OpenThread dedicated Spinel protocol backend" bool "Enable OpenThread dedicated Spinel protocol backend"
depends on (OPENTHREAD_NCP_SPINEL_ON_UART_DEV_NAME!=UART_CONSOLE_ON_DEV_NAME || !LOG_BACKEND_UART) depends on (OPENTHREAD_COPROCESSOR_SPINEL_ON_UART_DEV_NAME!=UART_CONSOLE_ON_DEV_NAME || !LOG_BACKEND_UART)
depends on NET_L2_OPENTHREAD depends on NET_L2_OPENTHREAD
help help
When enabled, backend will use OpenThread dedicated SPINEL protocol for logging. When enabled, backend will use OpenThread dedicated SPINEL protocol for logging.

View file

@ -141,6 +141,7 @@ endmenu # "Zephyr optimizations"
config OPENTHREAD_SHELL config OPENTHREAD_SHELL
bool "Enable OpenThread shell" bool "Enable OpenThread shell"
depends on !OPENTHREAD_COPROCESSOR
select SHELL select SHELL
default y default y
@ -173,43 +174,49 @@ config OPENTHREAD_MBEDTLS_LIB_NAME
This option allows to specify one or more mbedtls library files to be This option allows to specify one or more mbedtls library files to be
linked with OpenThread. Separate multiple values with space " ". linked with OpenThread. Separate multiple values with space " ".
menuconfig OPENTHREAD_NCP config OPENTHREAD_COPROCESSOR
bool "Network Co-Processor" bool "OpenThread Co-Processor"
select OPENTHREAD_MANUAL_START select OPENTHREAD_MANUAL_START
select RING_BUFFER select RING_BUFFER
select UART_INTERRUPT_DRIVEN select UART_INTERRUPT_DRIVEN
help help
Enable NCP in OpenThread stack. Enable Co-Processor in OpenThread stack.
if OPENTHREAD_NCP choice
prompt "OpenThread Co-Processor type"
config OPENTHREAD_NCP_RADIO
bool "Network Co-Processor as Radio"
help help
Enable NCP in OpenThread stack as radio-only. This option selects Thread network co-processor type
config OPENTHREAD_NCP_SPINEL_ON_UART_DEV_NAME config OPENTHREAD_COPROCESSOR_NCP
string "UART device to use for NCP SPINEL" bool "NCP - Network Co-Processor"
config OPENTHREAD_COPROCESSOR_RCP
bool "RCP - Radio Co-Processor"
endchoice
if OPENTHREAD_COPROCESSOR
config OPENTHREAD_COPROCESSOR_SPINEL_ON_UART_DEV_NAME
string "UART device to use for Co-Processor SPINEL"
default "UART_0" default "UART_0"
help help
UART device to use for NCP SPINEL. UART device to use for Co-Processor SPINEL.
config OPENTHREAD_NCP_UART_RING_BUFFER_SIZE config OPENTHREAD_COPROCESSOR_UART_RING_BUFFER_SIZE
int "Set NCP UART ring buffer size" int "Set Co-Processor UART ring buffer size"
default 4096 default 4096
help help
TX buffer size for the OpenThread NCP UART. TX buffer size for the OpenThread Co-Processor UART.
config OPENTHREAD_NCP_SPINEL_ON_UART_ACM config OPENTHREAD_COPROCESSOR_SPINEL_ON_UART_ACM
bool "Run SPINEL over USB-ACM" bool "Run SPINEL over USB-ACM"
depends on USB_CDC_ACM depends on USB_CDC_ACM
help help
Is the SPINEL device a USB-CDC-ACM device. Is the SPINEL device a USB-CDC-ACM device.
config OPENTHREAD_NCP_VENDOR_HOOK_SOURCE config OPENTHREAD_COPROCESSOR_VENDOR_HOOK_SOURCE
string "Path to NCP vendor hook source file" string "Path to vendor hook source file"
help help
Provides path to compile ncp vendor hook file inside NCP component. Provides path to compile vendor hook file.
config OPENTHREAD_NCP_BUFFER_SIZE config OPENTHREAD_NCP_BUFFER_SIZE
int "The size of the NCP buffers" int "The size of the NCP buffers"
@ -217,7 +224,7 @@ config OPENTHREAD_NCP_BUFFER_SIZE
help help
The size of the NCP buffers. The size of the NCP buffers.
endif # OPENTHREAD_NCP endif # OPENTHREAD_COPROCESSOR
config OPENTHREAD_PLATFORM_INFO config OPENTHREAD_PLATFORM_INFO
string "Platform information for OpenThread" string "Platform information for OpenThread"

View file

@ -147,7 +147,7 @@ static void ot_state_changed_handler(uint32_t flags, void *context)
struct openthread_context *ot_context = context; struct openthread_context *ot_context = context;
NET_INFO("State changed! Flags: 0x%08" PRIx32 " Current role: %d", NET_INFO("State changed! Flags: 0x%08" PRIx32 " Current role: %d",
flags, otThreadGetDeviceRole(ot_context->instance)); flags, otThreadGetDeviceRole(ot_context->instance));
if (flags & OT_CHANGED_IP6_ADDRESS_REMOVED) { if (flags & OT_CHANGED_IP6_ADDRESS_REMOVED) {
NET_DBG("Ipv6 address removed"); NET_DBG("Ipv6 address removed");
@ -194,9 +194,7 @@ static void ot_receive_handler(otMessage *aMessage, void *context)
pkt_buf = pkt->buffer; pkt_buf = pkt->buffer;
while (1) { while (1) {
read_len = otMessageRead(aMessage, read_len = otMessageRead(aMessage, offset, pkt_buf->data,
offset,
pkt_buf->data,
net_buf_tailroom(pkt_buf)); net_buf_tailroom(pkt_buf));
if (!read_len) { if (!read_len) {
break; break;
@ -326,10 +324,17 @@ int openthread_send(struct net_if *iface, struct net_pkt *pkt)
int openthread_start(struct openthread_context *ot_context) int openthread_start(struct openthread_context *ot_context)
{ {
otInstance *ot_instance = ot_context->instance; otInstance *ot_instance = ot_context->instance;
otError error; otError error = OT_ERROR_NONE;
openthread_api_mutex_lock(ot_context); openthread_api_mutex_lock(ot_context);
NET_INFO("OpenThread version: %s", otGetVersionString());
if (IS_ENABLED(CONFIG_OPENTHREAD_COPROCESSOR)) {
NET_DBG("OpenThread co-processor.");
goto exit;
}
otIp6SetEnabled(ot_context->instance, true); otIp6SetEnabled(ot_context->instance, true);
/* Sleepy End Device specific configuration. */ /* Sleepy End Device specific configuration. */
@ -377,7 +382,6 @@ int openthread_start(struct openthread_context *ot_context)
otThreadSetExtendedPanId(ot_instance, &xpanid); otThreadSetExtendedPanId(ot_instance, &xpanid);
} }
NET_INFO("OpenThread version: %s", otGetVersionString());
NET_INFO("Network name: %s", NET_INFO("Network name: %s",
log_strdup(otThreadGetNetworkName(ot_instance))); log_strdup(otThreadGetNetworkName(ot_instance)));
@ -397,6 +401,10 @@ int openthread_stop(struct openthread_context *ot_context)
{ {
otError error; otError error;
if (IS_ENABLED(CONFIG_OPENTHREAD_COPROCESSOR)) {
return 0;
}
openthread_api_mutex_lock(ot_context); openthread_api_mutex_lock(ot_context);
error = otThreadSetEnabled(ot_context->instance, false); error = otThreadSetEnabled(ot_context->instance, false);
@ -430,29 +438,25 @@ static int openthread_init(struct net_if *iface)
platformShellInit(ot_context->instance); platformShellInit(ot_context->instance);
} }
if (IS_ENABLED(CONFIG_OPENTHREAD_NCP)) { if (IS_ENABLED(CONFIG_OPENTHREAD_COPROCESSOR)) {
otNcpInit(ot_context->instance); otNcpInit(ot_context->instance);
} } else {
if (!IS_ENABLED(CONFIG_OPENTHREAD_NCP)) {
otIp6SetReceiveFilterEnabled(ot_context->instance, true); otIp6SetReceiveFilterEnabled(ot_context->instance, true);
otIp6SetReceiveCallback(ot_context->instance, otIp6SetReceiveCallback(ot_context->instance,
ot_receive_handler, ot_context); ot_receive_handler, ot_context);
otSetStateChangedCallback( otSetStateChangedCallback(ot_context->instance,
ot_context->instance, &ot_state_changed_handler,
&ot_state_changed_handler, ot_context);
ot_context);
}
net_mgmt_init_event_callback(&ip6_addr_cb, ipv6_addr_event_handler, net_mgmt_init_event_callback(
NET_EVENT_IPV6_ADDR_ADD | &ip6_addr_cb, ipv6_addr_event_handler,
NET_EVENT_IPV6_MADDR_ADD); NET_EVENT_IPV6_ADDR_ADD | NET_EVENT_IPV6_MADDR_ADD);
net_mgmt_add_event_callback(&ip6_addr_cb); net_mgmt_add_event_callback(&ip6_addr_cb);
}
ot_tid = k_thread_create(&ot_thread_data, ot_stack_area, ot_tid = k_thread_create(&ot_thread_data, ot_stack_area,
K_KERNEL_STACK_SIZEOF(ot_stack_area), K_KERNEL_STACK_SIZEOF(ot_stack_area),
openthread_process, openthread_process, ot_context, NULL, NULL,
ot_context, NULL, NULL,
OT_PRIORITY, 0, K_NO_WAIT); OT_PRIORITY, 0, K_NO_WAIT);
k_thread_name_set(&ot_thread_data, "openthread"); k_thread_name_set(&ot_thread_data, "openthread");

View file

@ -12,7 +12,7 @@ zephyr_library_sources(
) )
zephyr_library_sources_ifdef(CONFIG_OPENTHREAD_DIAG diag.c) zephyr_library_sources_ifdef(CONFIG_OPENTHREAD_DIAG diag.c)
zephyr_library_sources_ifdef(CONFIG_OPENTHREAD_NCP uart.c) zephyr_library_sources_ifdef(CONFIG_OPENTHREAD_COPROCESSOR uart.c)
zephyr_library_sources_ifdef(CONFIG_OPENTHREAD_SHELL shell.c) zephyr_library_sources_ifdef(CONFIG_OPENTHREAD_SHELL shell.c)
zephyr_library_sources_ifndef(CONFIG_LOG_BACKEND_SPINEL logging.c) zephyr_library_sources_ifndef(CONFIG_LOG_BACKEND_SPINEL logging.c)

View file

@ -30,7 +30,7 @@ void otSysProcessDrivers(otInstance *aInstance)
platformRadioProcess(aInstance); platformRadioProcess(aInstance);
platformAlarmProcess(aInstance); platformAlarmProcess(aInstance);
if (IS_ENABLED(CONFIG_OPENTHREAD_NCP)) { if (IS_ENABLED(CONFIG_OPENTHREAD_COPROCESSOR)) {
platformUartProcess(aInstance); platformUartProcess(aInstance);
} }
} }

View file

@ -409,7 +409,12 @@ void platformRadioProcess(otInstance *aInstance)
while ((tx_pkt = (struct net_pkt *)k_fifo_get(&tx_pkt_fifo, while ((tx_pkt = (struct net_pkt *)k_fifo_get(&tx_pkt_fifo,
K_NO_WAIT)) K_NO_WAIT))
!= NULL) { != NULL) {
openthread_handle_frame_to_send(aInstance, tx_pkt); if (IS_ENABLED(CONFIG_OPENTHREAD_COPROCESSOR_RCP)) {
net_pkt_unref(tx_pkt);
} else {
openthread_handle_frame_to_send(aInstance,
tx_pkt);
}
} }
} }

View file

@ -19,7 +19,7 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME);
#include <sys/ring_buffer.h> #include <sys/ring_buffer.h>
#include <sys/atomic.h> #include <sys/atomic.h>
#ifdef CONFIG_OPENTHREAD_NCP_SPINEL_ON_UART_ACM #ifdef CONFIG_OPENTHREAD_COPROCESSOR_SPINEL_ON_UART_ACM
#include <usb/usb_device.h> #include <usb/usb_device.h>
#endif #endif
@ -41,7 +41,7 @@ struct openthread_uart {
.rx_ringbuf = &_name##_rx_ringbuf, \ .rx_ringbuf = &_name##_rx_ringbuf, \
} }
OT_UART_DEFINE(ot_uart, CONFIG_OPENTHREAD_NCP_UART_RING_BUFFER_SIZE); OT_UART_DEFINE(ot_uart, CONFIG_OPENTHREAD_COPROCESSOR_UART_RING_BUFFER_SIZE);
#define RX_FIFO_SIZE 128 #define RX_FIFO_SIZE 128
@ -148,7 +148,7 @@ void platformUartProcess(otInstance *aInstance)
otError otPlatUartEnable(void) otError otPlatUartEnable(void)
{ {
ot_uart.dev = device_get_binding( ot_uart.dev = device_get_binding(
CONFIG_OPENTHREAD_NCP_SPINEL_ON_UART_DEV_NAME); CONFIG_OPENTHREAD_COPROCESSOR_SPINEL_ON_UART_DEV_NAME);
if ((&ot_uart)->dev == NULL) { if ((&ot_uart)->dev == NULL) {
LOG_ERR("UART device not found"); LOG_ERR("UART device not found");
@ -165,7 +165,7 @@ otError otPlatUartEnable(void)
otError otPlatUartDisable(void) otError otPlatUartDisable(void)
{ {
#ifdef CONFIG_OPENTHREAD_NCP_SPINEL_ON_UART_ACM #ifdef CONFIG_OPENTHREAD_COPROCESSOR_SPINEL_ON_UART_ACM
int ret = usb_disable(); int ret = usb_disable();
if (ret) { if (ret) {

View file

@ -111,7 +111,7 @@ manifest:
revision: 3f545d76a2e6d1db83a470ccdb5bebd1f484e137 revision: 3f545d76a2e6d1db83a470ccdb5bebd1f484e137
path: modules/lib/loramac-node path: modules/lib/loramac-node
- name: openthread - name: openthread
revision: 07f430dac6c400abdd358ba1173c0f94b94a5a80 revision: f9fbfad0119d7b0d473eaac50c2f0a0a483c2823
path: modules/lib/openthread path: modules/lib/openthread
- name: segger - name: segger
revision: 874d9e9696b00c09f9eeefe839028dc25fe44983 revision: 874d9e9696b00c09f9eeefe839028dc25fe44983