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 
66 #ifndef CONFIG_GNRC_GOMACH_CP_DURATION_US
67 #define CONFIG_GNRC_GOMACH_CP_DURATION_US (10U * US_PER_MS)
68 #endif
69 
90 #ifndef CONFIG_GNRC_GOMACH_SUPERFRAME_DURATION_US
91 #define CONFIG_GNRC_GOMACH_SUPERFRAME_DURATION_US (300LU * US_PER_MS)
92 #endif
93 
94 #ifndef RTT_FREQUENCY
95 #error "RTT_FREQUENCY undefined."
96 #else
97 #if ((CONFIG_GNRC_GOMACH_SUPERFRAME_DURATION_US < ((1000LU *US_PER_MS) / RTT_FREQUENCY)) || \
98  (CONFIG_GNRC_GOMACH_SUPERFRAME_DURATION_US < (10 * CONFIG_GNRC_GOMACH_CP_DURATION_US)))
99 #undef CONFIG_GNRC_GOMACH_SUPERFRAME_DURATION_US
100 #if (((1000LU *US_PER_MS) / RTT_FREQUENCY) > (10 * CONFIG_GNRC_GOMACH_CP_DURATION_US))
101 #define CONFIG_GNRC_GOMACH_SUPERFRAME_DURATION_US ((1000LU * US_PER_MS) / RTT_FREQUENCY)
102 #else
103 #define CONFIG_GNRC_GOMACH_SUPERFRAME_DURATION_US (10 * CONFIG_GNRC_GOMACH_CP_DURATION_US)
104 #endif
105 #endif
106 #endif
107 
118 #ifndef CONFIG_GNRC_GOMACH_CP_RANDOM_END_US
119 #define CONFIG_GNRC_GOMACH_CP_RANDOM_END_US (1U * US_PER_MS)
120 #endif
121 
133 #ifndef GNRC_GOMACH_CP_DURATION_MAX_US
134 #define GNRC_GOMACH_CP_DURATION_MAX_US (5LU * CONFIG_GNRC_GOMACH_CP_DURATION_US)
135 #endif
136 
149 #ifndef GNRC_GOMACH_WAIT_BEACON_TIME_US
150 #define GNRC_GOMACH_WAIT_BEACON_TIME_US (GNRC_GOMACH_CP_DURATION_MAX_US)
151 #endif
152 
162 #ifndef CONFIG_GNRC_GOMACH_CP_MIN_GAP_US
163 #define CONFIG_GNRC_GOMACH_CP_MIN_GAP_US (25U * US_PER_MS)
164 #endif
165 
174 #ifndef CONFIG_GNRC_GOMACH_WAIT_RX_END_US
175 #define CONFIG_GNRC_GOMACH_WAIT_RX_END_US (6U * US_PER_MS)
176 #endif
177 
186 #ifndef CONFIG_GNRC_GOMACH_NO_TX_ISR_US
187 #define CONFIG_GNRC_GOMACH_NO_TX_ISR_US (50U * US_PER_MS)
188 #endif
189 
197 #ifndef CONFIG_GNRC_GOMACH_MAX_PREAM_INTERVAL_US
198 #define CONFIG_GNRC_GOMACH_MAX_PREAM_INTERVAL_US (6U * US_PER_MS)
199 #endif
200 
212 #ifndef CONFIG_GNRC_GOMACH_PREAMBLE_INTERVAL_US
213 #define CONFIG_GNRC_GOMACH_PREAMBLE_INTERVAL_US (2U * US_PER_MS)
214 #endif
215 
225 #ifndef CONFIG_GNRC_GOMACH_BCAST_INTERVAL_US
226 #define CONFIG_GNRC_GOMACH_BCAST_INTERVAL_US (1U * US_PER_MS)
227 #endif
228 
240 #ifndef GNRC_GOMACH_PREAMBLE_DURATION_US
241 #define GNRC_GOMACH_PREAMBLE_DURATION_US \
242  (21LU * CONFIG_GNRC_GOMACH_SUPERFRAME_DURATION_US / 10)
243 #endif
244 
254 #ifndef CONFIG_GNRC_GOMACH_VTDMA_SLOT_SIZE_US
255 #define CONFIG_GNRC_GOMACH_VTDMA_SLOT_SIZE_US (5U * US_PER_MS)
256 #endif
257 
269 #ifndef CONFIG_GNRC_GOMACH_TX_BUSY_THRESHOLD
270 #define CONFIG_GNRC_GOMACH_TX_BUSY_THRESHOLD (5U)
271 #endif
272 
281 #ifndef CONFIG_GNRC_GOMACH_CP_EXTEND_THRESHOLD
282 #define CONFIG_GNRC_GOMACH_CP_EXTEND_THRESHOLD (5U)
283 #endif
284 
294 #ifndef CONFIG_GNRC_GOMACH_RX_DUPCHK_UNIT_LIFE
295 #define CONFIG_GNRC_GOMACH_RX_DUPCHK_UNIT_LIFE (30U)
296 #endif
297 
308 #ifndef CONFIG_GNRC_GOMACH_MAX_ALLOC_SENDER_NUM
309 #define CONFIG_GNRC_GOMACH_MAX_ALLOC_SENDER_NUM (11U)
310 #endif
311 
323 #ifndef CONFIG_GNRC_GOMACH_REPHASELOCK_THRESHOLD
324 #define CONFIG_GNRC_GOMACH_REPHASELOCK_THRESHOLD (4U)
325 #endif
326 
335 #ifndef CONFIG_GNRC_GOMACH_T2U_RETYR_THRESHOLD
336 #define CONFIG_GNRC_GOMACH_T2U_RETYR_THRESHOLD (2U)
337 #endif
338 
349 #ifndef CONFIG_GNRC_GOMACH_MAX_T2U_RETYR_THRESHOLD
350 #define CONFIG_GNRC_GOMACH_MAX_T2U_RETYR_THRESHOLD (10U)
351 #endif
352 
369 int gnrc_netif_gomach_create(gnrc_netif_t *netif, char *stack, int stacksize,
370  char priority, char *name, netdev_t *dev);
371 
372 #ifdef __cplusplus
373 }
374 #endif
375 
376 #endif /* NET_GNRC_GOMACH_GOMACH_H */
377 
Types used by the kernel.
int gnrc_netif_gomach_create(gnrc_netif_t *netif, char *stack, int stacksize, char priority, char *name, netdev_t *dev)
Creates an IEEE 802.15.4 GoMacH network interface.
Low-level RTT (Real Time Timer) peripheral driver interface definitions.
Structure to hold driver state.
Definition: netdev.h:283
Representation of a network interface.
Definition: netif.h:107
Definition for GNRC&#39;s network interfaces.