zephyr/include/net/openthread.h
Robert Lubos 83bb911a21 net: openthread: Update OpenThread version
Use the newest version of the OpenThread project, as updated in
https://github.com/zephyrproject-rtos/openthread/pull/2.

Introduce the following fixes along with the update (they're squashed to
retain bisectability of OT samples):

* Update configs and flags used
	Some OT configs were renamed, some new were introduced that Zephyr port
	needs to set.

* Add entropy platform driver
	OpenThreads `random` platform subsystem was replaced with `entropy`
	subsystem which is supposed to serve as an entropy source for the
	generic OpenThread's random generator.

* Halt OT thread when OT command is processed
	OpenThread can currently be processed from two threads - a
	genuine OpenThread thread and shell thread, which processes CLI
	commands. This could cause trouble, when context was switched
	during OT command processing (i.e. switched to process an incomming OT
	message, while still in unfinished command handler).

	In result, it was not possible to turn the commissioner role on via
	CLI, as the commissioner petition response was handled before the
	Commissioner::Start function finished its execution (if the
	petitioner is also the network leader, all messages are passed
	internally within the stack).

	Fix this by suspending the OT thread for the time of an OT command
	processing.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2019-10-28 13:00:56 +02:00

42 lines
736 B
C

/*
* Copyright (c) 2017 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_INCLUDE_NET_OPENTHREAD_H_
#define ZEPHYR_INCLUDE_NET_OPENTHREAD_H_
#include <kernel.h>
#include <net/net_if.h>
#include <openthread/instance.h>
#ifdef __cplusplus
extern "C" {
#endif
struct pkt_list_elem {
struct net_pkt *pkt;
};
struct openthread_context {
otInstance *instance;
struct net_if *iface;
u16_t pkt_list_in_idx;
u16_t pkt_list_out_idx;
u8_t pkt_list_full;
struct pkt_list_elem pkt_list[CONFIG_OPENTHREAD_PKT_LIST_SIZE];
};
k_tid_t openthread_thread_id_get(void);
#define OPENTHREAD_L2_CTX_TYPE struct openthread_context
#ifdef __cplusplus
}
#endif
#endif /* ZEPHYR_INCLUDE_NET_OPENTHREAD_H_ */