a752c7ab
elopes
add first test an...
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
/*
* Copyright (C) 2015 Daniel Krebs
* 2016 INRIA
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup net_gnrc_lwmac
* @{
*
* @file
* @brief Header definition LWMAC
* @internal
* @author Daniel Krebs <github@daniel-krebs.net>
* @author Shuguo Zhuo <shuguo.zhuo@inria.fr>
*/
#ifndef NET_GNRC_LWMAC_HDR_H
#define NET_GNRC_LWMAC_HDR_H
#include <stdint.h>
#include <stdbool.h>
#include "net/ieee802154.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief LWMAC WR (wake-up request packet, i.e., preamble packet) frame type
*/
#define GNRC_LWMAC_FRAMETYPE_WR (0x01U)
/**
* @brief LWMAC WA (wake-up answer packet, i.e., preamble-ACK packet) frame type
*/
#define GNRC_LWMAC_FRAMETYPE_WA (0x02U)
/**
* @brief LWMAC data frame type
*/
#define GNRC_LWMAC_FRAMETYPE_DATA (0x03U)
/**
* @brief LWMAC data frame type with pending data transmission request
*/
#define GNRC_LWMAC_FRAMETYPE_DATA_PENDING (0x04U)
/**
* @brief LWMAC broadcast frame type
*/
#define GNRC_LWMAC_FRAMETYPE_BROADCAST (0x05U)
/**
* @brief LWMAC internal L2 address structure
*/
typedef struct {
uint8_t addr[IEEE802154_LONG_ADDRESS_LEN]; /**< address of node */
uint8_t len; /**< address */
} gnrc_lwmac_l2_addr_t;
/**
* @brief Static initializer for l2_addr_t.
*/
#define GNRC_LWMAC_L2_ADDR_INITIAL { { 0 }, 0 }
/**
* @brief LWMAC header
*/
typedef struct {
uint8_t type; /**< type of frame */
} gnrc_lwmac_hdr_t;
/**
* @brief LWMAC WR (wake-up request packet, i.e., preamble packet) frame
*/
typedef struct __attribute__((packed)) {
gnrc_lwmac_hdr_t header; /**< WR packet header type */
gnrc_lwmac_l2_addr_t dst_addr; /**< WR is broadcast, so destination address needed */
} gnrc_lwmac_frame_wr_t;
/**
* @brief LWMAC WA (wake-up answer packet, i.e., preamble-ACK packet) frame
*/
typedef struct __attribute__((packed)) {
gnrc_lwmac_hdr_t header; /**< WA packet header type */
gnrc_lwmac_l2_addr_t dst_addr; /**< WA is broadcast, so destination address needed */
uint32_t current_phase; /**< Node's current phase value */
} gnrc_lwmac_frame_wa_t;
/**
* @brief LWMAC broadcast data frame
*/
typedef struct __attribute__((packed)) {
gnrc_lwmac_hdr_t header; /**< Broadcast packet header type */
uint8_t seq_nr; /**< Broadcast sequence */
} gnrc_lwmac_frame_broadcast_t;
/**
* @brief LWMAC unicast data frame
*/
typedef struct __attribute__((packed)) {
gnrc_lwmac_hdr_t header; /**< Data packet header type */
} gnrc_lwmac_frame_data_t;
#ifdef __cplusplus
}
#endif
#endif /* NET_GNRC_LWMAC_HDR_H */
/** @} */
|