Skip to content

Commit bdfaf7f

Browse files
KaSrokaAnas Nashif
authored andcommitted
include: net: net_l2: Add OpenThread L2
Add OpenThread L2 to L2 list. Signed-off-by: Kamil Sroka <[email protected]>
1 parent 83b2218 commit bdfaf7f

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

include/net/net_l2.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ NET_L2_DECLARE_PUBLIC(BLUETOOTH_L2);
9191
NET_L2_DECLARE_PUBLIC(OFFLOAD_IP);
9292
#endif /* CONFIG_NET_OFFLOAD */
9393

94+
#ifdef CONFIG_NET_L2_OPENTHREAD
95+
#define OPENTHREAD_L2 OPENTHREAD
96+
NET_L2_DECLARE_PUBLIC(OPENTHREAD_L2);
97+
#endif /* CONFIG_NET_L2_OPENTHREAD */
98+
9499
extern struct net_l2 __net_l2_end[];
95100

96101
#define NET_L2_INIT(_name, _recv_fn, _send_fn, _reserve_fn, _enable_fn) \

include/net/openthread.h

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Copyright (c) 2017 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#ifndef __NET_OPENTHREAD_H_
8+
#define __NET_OPENTHREAD_H_
9+
10+
#include <kernel.h>
11+
12+
#include <net/net_if.h>
13+
14+
#include <openthread/openthread.h>
15+
16+
#ifdef __cplusplus
17+
extern "C" {
18+
#endif
19+
20+
struct pkt_list_elem {
21+
struct net_pkt *pkt;
22+
};
23+
24+
struct openthread_context {
25+
otInstance *instance;
26+
struct net_if *iface;
27+
u16_t pkt_list_in_idx;
28+
u16_t pkt_list_out_idx;
29+
u8_t pkt_list_full;
30+
struct pkt_list_elem pkt_list[CONFIG_OPENTHREAD_PKT_LIST_SIZE];
31+
};
32+
33+
#define OPENTHREAD_L2_CTX_TYPE struct openthread_context
34+
35+
#ifdef __cplusplus
36+
}
37+
#endif
38+
39+
#endif /* __NET_OPENTHREAD_H_ */

0 commit comments

Comments
 (0)