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 
22 #ifndef NET_GNRC_GOMACH_GOMACH_H
23 #define NET_GNRC_GOMACH_GOMACH_H
24 
25 #include "periph/rtt.h"
26 #include "kernel_types.h"
27 #include "net/gnrc/netif.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
43 #ifndef GNRC_GOMACH_CP_DURATION_US
44 #define GNRC_GOMACH_CP_DURATION_US (10U * US_PER_MS)
45 #endif
46 
66 #ifndef GNRC_GOMACH_SUPERFRAME_DURATION_US
67 #define GNRC_GOMACH_SUPERFRAME_DURATION_US (300LU * US_PER_MS)
68 #endif
69 
70 #if ((GNRC_GOMACH_SUPERFRAME_DURATION_US < ((1000LU *US_PER_MS) / RTT_FREQUENCY)) || \
71  (GNRC_GOMACH_SUPERFRAME_DURATION_US < (10 *GNRC_GOMACH_CP_DURATION_US)))
72 #undef GNRC_GOMACH_SUPERFRAME_DURATION_US
73 #if (((1000LU *US_PER_MS) / RTT_FREQUENCY) > (10 * GNRC_GOMACH_CP_DURATION_US))
74 #define GNRC_GOMACH_SUPERFRAME_DURATION_US ((1000LU * US_PER_MS) / RTT_FREQUENCY)
75 #else
76 #define GNRC_GOMACH_SUPERFRAME_DURATION_US (10 * GNRC_GOMACH_CP_DURATION_US)
77 #endif
78 #endif
79 
89 #ifndef GNRC_GOMACH_CP_RANDOM_END_US
90 #define GNRC_GOMACH_CP_RANDOM_END_US (1U * US_PER_MS)
91 #endif
92 
104 #ifndef GNRC_GOMACH_CP_DURATION_MAX_US
105 #define GNRC_GOMACH_CP_DURATION_MAX_US (5LU * GNRC_GOMACH_CP_DURATION_US)
106 #endif
107 
120 #ifndef GNRC_GOMACH_WAIT_BEACON_TIME_US
121 #define GNRC_GOMACH_WAIT_BEACON_TIME_US (GNRC_GOMACH_CP_DURATION_MAX_US)
122 #endif
123 
133 #ifndef GNRC_GOMACH_CP_MIN_GAP_US
134 #define GNRC_GOMACH_CP_MIN_GAP_US (25U * US_PER_MS)
135 #endif
136 
145 #ifndef GNRC_GOMACH_WAIT_RX_END_US
146 #define GNRC_GOMACH_WAIT_RX_END_US (6U * US_PER_MS)
147 #endif
148 
157 #ifndef GNRC_GOMACH_NO_TX_ISR_US
158 #define GNRC_GOMACH_NO_TX_ISR_US (50U * US_PER_MS)
159 #endif
160 
168 #ifndef GNRC_GOMACH_MAX_PREAM_INTERVAL_US
169 #define GNRC_GOMACH_MAX_PREAM_INTERVAL_US (6U * US_PER_MS)
170 #endif
171 
183 #ifndef GNRC_GOMACH_PREAMBLE_INTERVAL_US
184 #define GNRC_GOMACH_PREAMBLE_INTERVAL_US (2U * US_PER_MS)
185 #endif
186 
196 #ifndef GNRC_GOMACH_BCAST_INTERVAL_US
197 #define GNRC_GOMACH_BCAST_INTERVAL_US (1U * US_PER_MS)
198 #endif
199 
211 #ifndef GNRC_GOMACH_PREAMBLE_DURATION_US
212 #define GNRC_GOMACH_PREAMBLE_DURATION_US (21LU * GNRC_GOMACH_SUPERFRAME_DURATION_US / 10)
213 #endif
214 
224 #ifndef GNRC_GOMACH_VTDMA_SLOT_SIZE_US
225 #define GNRC_GOMACH_VTDMA_SLOT_SIZE_US (5U * US_PER_MS)
226 #endif
227 
239 #ifndef GNRC_GOMACH_TX_BUSY_THRESHOLD
240 #define GNRC_GOMACH_TX_BUSY_THRESHOLD (5U)
241 #endif
242 
251 #ifndef GNRC_GOMACH_CP_EXTEND_THRESHOLD
252 #define GNRC_GOMACH_CP_EXTEND_THRESHOLD (5U)
253 #endif
254 
264 #ifndef GNRC_GOMACH_RX_DUPCHK_UNIT_LIFE
265 #define GNRC_GOMACH_RX_DUPCHK_UNIT_LIFE (30U)
266 #endif
267 
275 #ifndef GNRC_GOMACH_MAX_ALLOC_SLOTS_NUM
276 #define GNRC_GOMACH_MAX_ALLOC_SLOTS_NUM (25U)
277 #endif
278 
288 #ifndef GNRC_GOMACH_MAX_ALLOC_SENDER_NUM
289 #define GNRC_GOMACH_MAX_ALLOC_SENDER_NUM (11U)
290 #endif
291 
303 #ifndef GNRC_GOMACH_REPHASELOCK_THRESHOLD
304 #define GNRC_GOMACH_REPHASELOCK_THRESHOLD (4U)
305 #endif
306 
315 #ifndef GNRC_GOMACH_T2U_RETYR_THRESHOLD
316 #define GNRC_GOMACH_T2U_RETYR_THRESHOLD (2U)
317 #endif
318 
329 #ifndef GNRC_GOMACH_MAX_T2U_RETYR_THRESHOLD
330 #define GNRC_GOMACH_MAX_T2U_RETYR_THRESHOLD (10U)
331 #endif
332 
339 #ifndef GNRC_GOMACH_IPC_MSG_QUEUE_SIZE
340 #define GNRC_GOMACH_IPC_MSG_QUEUE_SIZE (8U)
341 #endif
342 
357 gnrc_netif_t *gnrc_netif_gomach_create(char *stack, int stacksize,
358  char priority, char *name,
359  netdev_t *dev);
360 
361 #ifdef __cplusplus
362 }
363 #endif
364 
365 #endif /* NET_GNRC_GOMACH_GOMACH_H */
366 
Types used by the kernel.
Definition for GNRC&#39;s network interfaces.
Low-level RTT (Real Time Timer) peripheral driver interface definitions.
Structure to hold driver state.
Definition: netdev.h:274
Representation of a network interface.
Definition: netif.h:61
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.