include: net: net_l2: Add OpenThread L2

Add OpenThread L2 to L2 list.

Signed-off-by: Kamil Sroka <kamil.sroka@nordicsemi.no>
This commit is contained in:
Kamil Sroka 2018-01-15 11:38:21 +01:00 committed by Anas Nashif
commit bdfaf7f994
2 changed files with 44 additions and 0 deletions

View file

@ -91,6 +91,11 @@ NET_L2_DECLARE_PUBLIC(BLUETOOTH_L2);
NET_L2_DECLARE_PUBLIC(OFFLOAD_IP);
#endif /* CONFIG_NET_OFFLOAD */
#ifdef CONFIG_NET_L2_OPENTHREAD
#define OPENTHREAD_L2 OPENTHREAD
NET_L2_DECLARE_PUBLIC(OPENTHREAD_L2);
#endif /* CONFIG_NET_L2_OPENTHREAD */
extern struct net_l2 __net_l2_end[];
#define NET_L2_INIT(_name, _recv_fn, _send_fn, _reserve_fn, _enable_fn) \

39
include/net/openthread.h Normal file
View file

@ -0,0 +1,39 @@
/*
* Copyright (c) 2017 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef __NET_OPENTHREAD_H_
#define __NET_OPENTHREAD_H_
#include <kernel.h>
#include <net/net_if.h>
#include <openthread/openthread.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];
};
#define OPENTHREAD_L2_CTX_TYPE struct openthread_context
#ifdef __cplusplus
}
#endif
#endif /* __NET_OPENTHREAD_H_ */