Loading...
Searching...
No Matches
ot.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2017 Fundacion Inria Chile
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
53#ifndef OT_H
54#define OT_H
55
56#ifdef __cplusplus
57extern "C" {
58#endif
59
60#include "net/netopt.h"
61#include "net/ieee802154.h"
62#include "net/ethernet.h"
63#include "net/netdev.h"
64#include "thread.h"
65#include "openthread/instance.h"
66#include "event.h"
67
73#define OPENTHREAD_NUMBER_OF_SERIAL_BUFFER (1U)
75#define OPENTHREAD_SIZEOF_LENGTH_AND_FREEBUFF (4U)
77#define OPENTHREAD_SERIAL_BUFFER_SIZE OPENTHREAD_SIZEOF_LENGTH_AND_FREEBUFF + 100
79#define OPENTHREAD_SERIAL_BUFFER__PAYLOAD_SIZE OPENTHREAD_SERIAL_BUFFER_SIZE - OPENTHREAD_SIZEOF_LENGTH_AND_FREEBUFF
81#define OPENTHREAD_ERROR_NO_EMPTY_SERIAL_BUFFER -1
83#define OPENTHREAD_SERIAL_BUFFER_STATUS_FREE (0x0001)
85#define OPENTHREAD_SERIAL_BUFFER_STATUS_READY_TO_PROCESS (0x0002)
87#define OPENTHREAD_SERIAL_BUFFER_STATUS_FULL (0x0004)
89#define IEEE802154_MAX_LENGTH (127U)
91#define OPENTHREAD_NETDEV_BUFLEN (IEEE802154_MAX_LENGTH)
97typedef struct {
98 uint16_t length;
102
109void recv_pkt(otInstance *aInstance, netdev_t *dev);
110
118void send_pkt(otInstance *aInstance, netdev_t *dev, netdev_event_t event);
119
126
132otInstance* openthread_get_instance(void);
133
138
146void openthread_radio_init(netdev_t *dev, uint8_t *tb, uint8_t *rb);
147
160int openthread_netdev_init(char *stack, int stacksize, char priority, const char *name, netdev_t *netdev);
161
165void ot_random_init(void);
166
167#ifdef __cplusplus
168}
169#endif
170
171#endif /* OT_H */
Definitions low-level network driver interface.
Definitions for Ethernet.
netdev_event_t
Possible event types that are send from the device driver to the upper layer.
Definition netdev.h:235
otInstance * openthread_get_instance(void)
Get pointer to the OpenThread instance.
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:79
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.
Definition of global configuration options.
event queue structure
Definition event.h:156
event structure
Definition event.h:148
Structure to hold driver state.
Definition netdev.h:363
Struct containing a serial message.
Definition ot.h:97
uint16_t serial_buffer_status
status of the buffer
Definition ot.h:99
uint16_t length
length of the message
Definition ot.h:98
IEEE 802.15.4 header definitions.