Loading...
Searching...
No Matches
types.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2015 Daniel Krebs
3 * 2016 INRIA
4 *
5 * This file is subject to the terms and conditions of the GNU Lesser
6 * General Public License v2.1. See the file LICENSE in the top level
7 * directory for more details.
8 */
9
21#ifndef NET_GNRC_MAC_TYPES_H
22#define NET_GNRC_MAC_TYPES_H
23
24#include <stdint.h>
25#include <stdbool.h>
26
27#include "net/gnrc/pkt.h"
29#include "net/ieee802154.h"
30#include "net/gnrc/mac/mac.h"
31#ifdef MODULE_GNRC_LWMAC
33#endif
34#ifdef MODULE_GNRC_GOMACH
36#endif
37
38#ifdef __cplusplus
39extern "C" {
40#endif
41
45#define GNRC_MAC_TYPE_GET_DUTYCYCLE (0x4401)
46
56
60#define GNRC_MAC_TX_FEEDBACK_INIT { TX_FEEDBACK_UNDEF }
61
62#if ((GNRC_MAC_RX_QUEUE_SIZE != 0) || (GNRC_MAC_DISPATCH_BUFFER_SIZE != 0)) || defined(DOXYGEN)
70typedef struct {
71#if (GNRC_MAC_RX_QUEUE_SIZE != 0) || defined(DOXYGEN)
74#endif /* (GNRC_MAC_RX_QUEUE_SIZE != 0) || defined(DOXYGEN) */
75
76#if (GNRC_MAC_DISPATCH_BUFFER_SIZE != 0) || defined(DOXYGEN)
78#endif /* (GNRC_MAC_DISPATCH_BUFFER_SIZE != 0) || defined(DOXYGEN) */
79
80#ifdef MODULE_GNRC_LWMAC
81 gnrc_lwmac_l2_addr_t l2_addr;
83 uint8_t rx_bad_exten_count;
84#endif
85
86#ifdef MODULE_GNRC_GOMACH
87 gnrc_gomach_listen_state_t listen_state;
89 gnrc_gomach_vtdma_manag_t vtdma_manag;
90 gnrc_gomach_dupchk_t check_dup_pkt;
91#endif
93
97#if ((GNRC_MAC_RX_QUEUE_SIZE != 0) && (GNRC_MAC_DISPATCH_BUFFER_SIZE != 0)) || defined(DOXYGEN)
98#define GNRC_MAC_RX_INIT { \
99 PRIORITY_PKTQUEUE_INIT, \
100 { PRIORITY_PKTQUEUE_NODE_INIT(0, NULL) }, \
101 { NULL }, \
102}
103#elif (GNRC_MAC_RX_QUEUE_SIZE != 0) && (GNRC_MAC_DISPATCH_BUFFER_SIZE == 0) || defined(DOXYGEN)
104#define GNRC_MAC_RX_INIT { \
105 PRIORITY_PKTQUEUE_INIT, \
106 { PRIORITY_PKTQUEUE_NODE_INIT(0, NULL) }, \
107}
108#elif (GNRC_MAC_RX_QUEUE_SIZE == 0) && (GNRC_MAC_DISPATCH_BUFFER_SIZE != 0) || defined(DOXYGEN)
109#define GNRC_MAC_RX_INIT { \
110 { NULL }, \
111}
112#endif /* ((GNRC_MAC_RX_QUEUE_SIZE != 0) && (GNRC_MAC_DISPATCH_BUFFER_SIZE != 0)) || defined(DOXYGEN) */
113#endif /* ((GNRC_MAC_RX_QUEUE_SIZE != 0) || (GNRC_MAC_DISPATCH_BUFFER_SIZE != 0)) || defined(DOXYGEN) */
114
115#if (CONFIG_GNRC_MAC_NEIGHBOR_COUNT != 0) || defined(DOXYGEN)
119typedef struct {
121 uint8_t l2_addr_len;
122 uint32_t phase;
124#if (GNRC_MAC_TX_QUEUE_SIZE != 0) || defined(DOXYGEN)
126#endif /* (GNRC_MAC_TX_QUEUE_SIZE != 0) || defined(DOXYGEN) */
127
128#ifdef MODULE_GNRC_GOMACH
129 uint16_t pub_chanseq;
130 uint32_t cp_phase;
131 uint8_t mac_type;
132#endif
134
138#define GNRC_MAC_PHASE_UNINITIALIZED (0)
139
143#define GNRC_MAC_PHASE_MAX (-1)
144
148#if (GNRC_MAC_TX_QUEUE_SIZE != 0) || defined(DOXYGEN)
149#define GNRC_MAC_TX_NEIGHBOR_INIT { \
150 { 0 }, \
151 0, \
152 GNRC_MAC_PHASE_UNINITIALIZED, \
153 PRIORITY_PKTQUEUE_INIT, \
154}
155#else
156#define GNRC_MAC_TX_NEIGHBOR_INIT { \
157 { 0 }, \
158 0, \
159 GNRC_MAC_PHASE_UNINITIALIZED, \
160}
161#endif /* (GNRC_MAC_TX_QUEUE_SIZE != 0) || defined(DOXYGEN) */
162#endif /* (CONFIG_GNRC_MAC_NEIGHBOR_COUNT != 0) || defined(DOXYGEN) */
163
164#if ((GNRC_MAC_TX_QUEUE_SIZE != 0) || (CONFIG_GNRC_MAC_NEIGHBOR_COUNT != 0)) || defined(DOXYGEN)
172typedef struct {
173#if (CONFIG_GNRC_MAC_NEIGHBOR_COUNT != 0) || defined(DOXYGEN)
178#endif /* (CONFIG_GNRC_MAC_NEIGHBOR_COUNT != 0) || defined(DOXYGEN) */
179
180#if (GNRC_MAC_TX_QUEUE_SIZE != 0) || defined(DOXYGEN)
181#if (CONFIG_GNRC_MAC_NEIGHBOR_COUNT == 0) || defined(DOXYGEN)
184#endif /* (CONFIG_GNRC_MAC_NEIGHBOR_COUNT == 0) || defined(DOXYGEN) */
185
188#endif /* (GNRC_MAC_TX_QUEUE_SIZE != 0) || defined(DOXYGEN) */
189
190#ifdef MODULE_GNRC_LWMAC
192 uint32_t wr_sent;
193 uint32_t timestamp;
194 uint8_t bcast_seqnr;
195 uint8_t tx_burst_count;
196 uint8_t tx_retry_count;
197 uint8_t preamble_fail_counts;
198#endif
199
200#ifdef MODULE_GNRC_GOMACH
201 gnrc_gomach_transmit_state_t transmit_state;
202 gnrc_gomach_bcast_state_t bcast_state;
203 gnrc_gomach_t2k_state_t t2k_state;
204 gnrc_gomach_t2u_state_t t2u_state;
205 uint8_t preamble_sent;
206 uint8_t broadcast_seq;
207 uint8_t tx_seq;
208 gnrc_gomach_vtdma_t vtdma_para;
209 uint8_t no_ack_counter;
210 uint8_t t2u_retry_counter;
211 uint8_t last_tx_neighbor_id;
212 uint8_t tx_busy_count;
213 uint8_t t2u_fail_count;
214#endif
216
220#if ((GNRC_MAC_TX_QUEUE_SIZE != 0) && (CONFIG_GNRC_MAC_NEIGHBOR_COUNT != 0)) || defined(DOXYGEN)
221#define GNRC_MAC_TX_INIT { \
222 { GNRC_MAC_TX_NEIGHBOR_INIT }, \
223 NULL, \
224 { PRIORITY_PKTQUEUE_NODE_INIT(0, NULL) }, \
225 NULL, \
226}
227#elif ((GNRC_MAC_TX_QUEUE_SIZE != 0) && (CONFIG_GNRC_MAC_NEIGHBOR_COUNT == 0)) || defined(DOXYGEN)
228#define GNRC_MAC_TX_INIT { \
229 PRIORITY_PKTQUEUE_INIT, \
230 { PRIORITY_PKTQUEUE_NODE_INIT(0, NULL) }, \
231 NULL, \
232}
233#elif ((GNRC_MAC_TX_QUEUE_SIZE == 0) && (CONFIG_GNRC_MAC_NEIGHBOR_COUNT != 0)) || defined(DOXYGEN)
234#define GNRC_MAC_TX_INIT { \
235 { GNRC_MAC_TX_NEIGHBOR_INIT }, \
236 NULL, \
237}
238#endif /* ((GNRC_MAC_TX_QUEUE_SIZE != 0) && (CONFIG_GNRC_MAC_NEIGHBOR_COUNT != 0)) || defined(DOXYGEN) */
239#endif /* ((GNRC_MAC_TX_QUEUE_SIZE != 0) || (CONFIG_GNRC_MAC_NEIGHBOR_COUNT != 0)) || defined(DOXYGEN) */
240
241#ifdef __cplusplus
242}
243#endif
244
245#endif /* NET_GNRC_MAC_TYPES_H */
#define CONFIG_GNRC_MAC_NEIGHBOR_COUNT
Count of neighbor nodes in one-hop distance.
Definition mac.h:66
#define GNRC_MAC_DISPATCH_BUFFER_SIZE
The default buffer size for storing dispatching packets.
Definition mac.h:114
#define GNRC_MAC_TX_QUEUE_SIZE
The default queue size for transmission packets coming from higher layers.
Definition mac.h:122
#define GNRC_MAC_RX_QUEUE_SIZE
The default rx queue size for incoming packets.
Definition mac.h:107
#define IEEE802154_LONG_ADDRESS_LEN
long address (EUI-64)
Definition ieee802154.h:45
Definitions of GNRC_MAC.
General definitions for network packets and their helper functions.
gnrc priority packet queue API
GoMacH's data structure for recording TX information for avoiding receiving duplicate packets.
Definition types.h:231
GoMacH's slot-schedule-unit.
Definition types.h:205
GoMacH's vTDMA (dynamic slots allocation) management unit.
Definition types.h:213
Sender's vTDMA (dynamic slots allocation) management unit.
Definition types.h:251
LWMAC internal L2 address structure.
Definition hdr.h:61
MAC internal type for storing reception state parameters and state machines.
Definition types.h:70
gnrc_priority_pktqueue_t queue
RX packet queue.
Definition types.h:72
type for storing states of TX neighbor node.
Definition types.h:119
uint8_t l2_addr_len
Neighbor address length.
Definition types.h:121
uint32_t phase
Neighbor's wake-up Phase.
Definition types.h:122
gnrc_priority_pktqueue_t queue
TX queue for this particular Neighbor.
Definition types.h:125
MAC internal type for storing transmission state parameters and state machines.
Definition types.h:172
gnrc_pktsnip_t * packet
currently scheduled packet for sending
Definition types.h:187
gnrc_priority_pktqueue_t queue
If neighbor queues is not used, define a single queue for managing TX packets.
Definition types.h:182
gnrc_mac_tx_neighbor_t * current_neighbor
Neighbor information unit of destination node to which the current packet will be sent.
Definition types.h:176
Type to represent parts (either headers or payload) of a packet, called snips.
Definition pkt.h:108
data type for gnrc priority packet queue nodes
data type for priority queues
Internal used types of GoMacH.
gnrc_gomach_t2k_state_t
State-machine states of Transmission-to-phase-known (t2k) procedure of GoMacH.
Definition types.h:100
gnrc_gomach_bcast_state_t
State-machine states of Broadcast procedure of GoMacH.
Definition types.h:88
gnrc_gomach_listen_state_t
State-machine states of duty-cycled listening procedure of GoMacH.
Definition types.h:149
gnrc_gomach_transmit_state_t
State-machine states of basic transmission management procedure of GoMacH.
Definition types.h:166
gnrc_gomach_t2u_state_t
State-machine states of Transmission-to-phase-unknown (t2u) procedure of GoMacH.
Definition types.h:116
#define GNRC_GOMACH_SLOSCH_UNIT_COUNT
The default number of slot-schedule-unit gnrc_gomach_slosch_unit_t in GoMacH.
Definition types.h:71
Definition of internal types used by LWMAC.
gnrc_lwmac_tx_state_t
TX states of LWMAC.
Definition types.h:124
gnrc_lwmac_rx_state_t
RX states of LWMAC.
Definition types.h:145
gnrc_mac_tx_feedback_t
definition for device transmission feedback types
Definition types.h:50
@ TX_FEEDBACK_BUSY
found medium busy when doing transmission
Definition types.h:54
@ TX_FEEDBACK_SUCCESS
Transmission succeeded.
Definition types.h:52
@ TX_FEEDBACK_NOACK
No ACK for the transmitted packet.
Definition types.h:53
@ TX_FEEDBACK_UNDEF
Transmission just start, no Tx feedback yet.
Definition types.h:51
IEEE 802.15.4 header definitions.