gomach.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 INRIA
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 
40 #ifndef NET_GNRC_GOMACH_GOMACH_H
41 #define NET_GNRC_GOMACH_GOMACH_H
42 
43 #include "periph/rtt.h"
44 #include "kernel_types.h"
45 #include "net/gnrc/netif.h"
46 
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
50 
61 #ifndef GNRC_GOMACH_CP_DURATION_US
62 #define GNRC_GOMACH_CP_DURATION_US (10U * US_PER_MS)
63 #endif
64 
84 #ifndef GNRC_GOMACH_SUPERFRAME_DURATION_US
85 #define GNRC_GOMACH_SUPERFRAME_DURATION_US (300LU * US_PER_MS)
86 #endif
87 
88 #if ((GNRC_GOMACH_SUPERFRAME_DURATION_US < ((1000LU *US_PER_MS) / RTT_FREQUENCY)) || \
89  (GNRC_GOMACH_SUPERFRAME_DURATION_US < (10 *GNRC_GOMACH_CP_DURATION_US)))
90 #undef GNRC_GOMACH_SUPERFRAME_DURATION_US
91 #if (((1000LU *US_PER_MS) / RTT_FREQUENCY) > (10 * GNRC_GOMACH_CP_DURATION_US))
92 #define GNRC_GOMACH_SUPERFRAME_DURATION_US ((1000LU * US_PER_MS) / RTT_FREQUENCY)
93 #else
94 #define GNRC_GOMACH_SUPERFRAME_DURATION_US (10 * GNRC_GOMACH_CP_DURATION_US)
95 #endif
96 #endif
97 
107 #ifndef GNRC_GOMACH_CP_RANDOM_END_US
108 #define GNRC_GOMACH_CP_RANDOM_END_US (1U * US_PER_MS)
109 #endif
110 
122 #ifndef GNRC_GOMACH_CP_DURATION_MAX_US
123 #define GNRC_GOMACH_CP_DURATION_MAX_US (5LU * GNRC_GOMACH_CP_DURATION_US)
124 #endif
125 
138 #ifndef GNRC_GOMACH_WAIT_BEACON_TIME_US
139 #define GNRC_GOMACH_WAIT_BEACON_TIME_US (GNRC_GOMACH_CP_DURATION_MAX_US)
140 #endif
141 
151 #ifndef GNRC_GOMACH_CP_MIN_GAP_US
152 #define GNRC_GOMACH_CP_MIN_GAP_US (25U * US_PER_MS)
153 #endif
154 
163 #ifndef GNRC_GOMACH_WAIT_RX_END_US
164 #define GNRC_GOMACH_WAIT_RX_END_US (6U * US_PER_MS)
165 #endif
166 
175 #ifndef GNRC_GOMACH_NO_TX_ISR_US
176 #define GNRC_GOMACH_NO_TX_ISR_US (50U * US_PER_MS)
177 #endif
178 
186 #ifndef GNRC_GOMACH_MAX_PREAM_INTERVAL_US
187 #define GNRC_GOMACH_MAX_PREAM_INTERVAL_US (6U * US_PER_MS)
188 #endif
189 
201 #ifndef GNRC_GOMACH_PREAMBLE_INTERVAL_US
202 #define GNRC_GOMACH_PREAMBLE_INTERVAL_US (2U * US_PER_MS)
203 #endif
204 
214 #ifndef GNRC_GOMACH_BCAST_INTERVAL_US
215 #define GNRC_GOMACH_BCAST_INTERVAL_US (1U * US_PER_MS)
216 #endif
217 
229 #ifndef GNRC_GOMACH_PREAMBLE_DURATION_US
230 #define GNRC_GOMACH_PREAMBLE_DURATION_US (21LU * GNRC_GOMACH_SUPERFRAME_DURATION_US / 10)
231 #endif
232 
242 #ifndef GNRC_GOMACH_VTDMA_SLOT_SIZE_US
243 #define GNRC_GOMACH_VTDMA_SLOT_SIZE_US (5U * US_PER_MS)
244 #endif
245 
257 #ifndef GNRC_GOMACH_TX_BUSY_THRESHOLD
258 #define GNRC_GOMACH_TX_BUSY_THRESHOLD (5U)
259 #endif
260 
269 #ifndef GNRC_GOMACH_CP_EXTEND_THRESHOLD
270 #define GNRC_GOMACH_CP_EXTEND_THRESHOLD (5U)
271 #endif
272 
282 #ifndef GNRC_GOMACH_RX_DUPCHK_UNIT_LIFE
283 #define GNRC_GOMACH_RX_DUPCHK_UNIT_LIFE (30U)
284 #endif
285 
295 #ifndef GNRC_GOMACH_MAX_ALLOC_SENDER_NUM
296 #define GNRC_GOMACH_MAX_ALLOC_SENDER_NUM (11U)
297 #endif
298 
310 #ifndef GNRC_GOMACH_REPHASELOCK_THRESHOLD
311 #define GNRC_GOMACH_REPHASELOCK_THRESHOLD (4U)
312 #endif
313 
322 #ifndef GNRC_GOMACH_T2U_RETYR_THRESHOLD
323 #define GNRC_GOMACH_T2U_RETYR_THRESHOLD (2U)
324 #endif
325 
336 #ifndef GNRC_GOMACH_MAX_T2U_RETYR_THRESHOLD
337 #define GNRC_GOMACH_MAX_T2U_RETYR_THRESHOLD (10U)
338 #endif
339 
346 #ifndef GNRC_GOMACH_IPC_MSG_QUEUE_SIZE
347 #define GNRC_GOMACH_IPC_MSG_QUEUE_SIZE (8U)
348 #endif
349 
364 gnrc_netif_t *gnrc_netif_gomach_create(char *stack, int stacksize,
365  char priority, char *name,
366  netdev_t *dev);
367 
368 #ifdef __cplusplus
369 }
370 #endif
371 
372 #endif /* NET_GNRC_GOMACH_GOMACH_H */
373 
Types used by the kernel.
Low-level RTT (Real Time Timer) peripheral driver interface definitions.
Structure to hold driver state.
Definition: netdev.h:275
Representation of a network interface.
Definition: gnrc/netif.h:62
Definition for GNRC&#39;s network interfaces.
gnrc_netif_t * gnrc_netif_gomach_create(char *stack, int stacksize, char priority, char *name, netdev_t *dev)
Creates an IEEE 802.15.4 GoMacH network interface.