Loading...
Searching...
No Matches
ot.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2017 Inria
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
51
52#ifdef __cplusplus
53extern "C" {
54#endif
55
56#include "net/netopt.h"
57#include "net/ieee802154.h"
58#include "net/ethernet.h"
59#include "net/netdev.h"
60#include "thread.h"
61#include "openthread/instance.h"
62#include "event.h"
63
69#define OPENTHREAD_NUMBER_OF_SERIAL_BUFFER (1U)
71#define OPENTHREAD_SIZEOF_LENGTH_AND_FREEBUFF (4U)
73#define OPENTHREAD_SERIAL_BUFFER_SIZE OPENTHREAD_SIZEOF_LENGTH_AND_FREEBUFF \
74 + 100
75
76#define OPENTHREAD_SERIAL_BUFFER__PAYLOAD_SIZE OPENTHREAD_SERIAL_BUFFER_SIZE \
77 - OPENTHREAD_SIZEOF_LENGTH_AND_FREEBUFF
78
79#define OPENTHREAD_ERROR_NO_EMPTY_SERIAL_BUFFER -1
81#define OPENTHREAD_SERIAL_BUFFER_STATUS_FREE (0x0001)
83#define OPENTHREAD_SERIAL_BUFFER_STATUS_READY_TO_PROCESS (0x0002)
85#define OPENTHREAD_SERIAL_BUFFER_STATUS_FULL (0x0004)
87#define IEEE802154_MAX_LENGTH (127U)
89#define OPENTHREAD_NETDEV_BUFLEN (IEEE802154_MAX_LENGTH)
91
100
107void recv_pkt(otInstance *aInstance, netdev_t *dev);
108
116void send_pkt(otInstance *aInstance, netdev_t *dev, netdev_event_t event);
117
124
130otInstance* openthread_get_instance(void);
131
136
144void openthread_radio_init(netdev_t *dev, uint8_t *tb, uint8_t *rb);
145
158int openthread_netdev_init(char *stack, int stacksize, char priority, const char *name,
160
164void ot_random_init(void);
165
169void ot_shell_init(otInstance *aInstance);
170
171#ifdef __cplusplus
172}
173#endif
174
Definitions low-level network driver interface.
Definitions for Ethernet.
struct netdev netdev_t
Forward declaration for netdev struct.
Definition netdev.h:285
netdev_event_t
Possible event types that are send from the device driver to the upper layer.
Definition netdev.h:231
otInstance * openthread_get_instance(void)
Get pointer to the OpenThread instance.
void ot_shell_init(otInstance *aInstance)
Init shell for OpenThread CLI.
void send_pkt(otInstance *aInstance, netdev_t *dev, netdev_event_t event)
Inform OpenThread when tx is finished.
void openthread_bootstrap(void)
Bootstrap OpenThread.
void ot_random_init(void)
Init OpenThread random.
event_queue_t * openthread_get_evq(void)
Get OpenThread event queue.
#define OPENTHREAD_SERIAL_BUFFER__PAYLOAD_SIZE
sizeof the spinel payload data
Definition ot.h:76
void openthread_radio_init(netdev_t *dev, uint8_t *tb, uint8_t *rb)
Init OpenThread radio.
int openthread_netdev_init(char *stack, int stacksize, char priority, const char *name, netdev_t *netdev)
Starts OpenThread thread.
void recv_pkt(otInstance *aInstance, netdev_t *dev)
Gets packet from driver and tells OpenThread about the reception.
struct PTRTAG event_queue_t
event queue structure
Definition of global configuration options.
event structure
Definition event.h:142
Structure to hold driver state.
Definition netdev.h:365
Struct containing a serial message.
Definition ot.h:95
uint8_t buf[OPENTHREAD_SERIAL_BUFFER__PAYLOAD_SIZE]
buffer containing the message
Definition ot.h:98
uint16_t serial_buffer_status
status of the buffer
Definition ot.h:97
uint16_t length
length of the message
Definition ot.h:96
IEEE 802.15.4 header definitions.