gomach_internal.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 
19 #ifndef GOMACH_INTERNAL_H
20 #define GOMACH_INTERNAL_H
21 
22 #include <stdint.h>
23 
24 #include "periph/rtt.h"
25 #include "net/gnrc/netif.h"
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
34 #define GNRC_GOMACH_INFO_TX_FINISHED (0x0008U)
35 
39 #define GNRC_GOMACH_INFO_PKT_RECEIVED (0x0010U)
40 
44 #define GNRC_GOMACH_INTERNAL_INFO_ND_UPDATE (0x0001U)
45 
49 #define GNRC_GOMACH_INTERNAL_INFO_QUIT_CYCLE (0x0002U)
50 
54 #define GNRC_GOMACH_INTERNAL_INFO_CP_END (0x0004U)
55 
59 #define GNRC_GOMACH_INTERNAL_INFO_VTDMA_END (0x0008U)
60 
64 #define GNRC_GOMACH_INTERNAL_INFO_UNINTD_PREAMBLE (0x0010U)
65 
69 #define GNRC_GOMACH_INTERNAL_INFO_GOT_PREAMBLE (0x0020U)
70 
74 #define GNRC_GOMACH_INTERNAL_INFO_DUTY_CYCLE_START (0x0040U)
75 
79 #define GNRC_GOMACH_INTERNAL_INFO_PHASE_BACKOFF (0x0080U)
80 
84 #define GNRC_GOMACH_INTERNAL_INFO_BEACON_FAIL (0x0200U)
85 
89 #define GNRC_GOMACH_INTERNAL_INFO_BUFFER_FULL (0x0400U)
90 
94 #define GNRC_GOMACH_INTERNAL_INFO_ENTER_NEW_CYCLE (0x0800U)
95 
99 #define GNRC_GOMACH_INTERNAL_INFO_GOT_PREAMBLEACK (0x1000U)
100 
104 #define GNRC_GOMACH_INTERNAL_INFO_ON_PUBCHAN_1 (0x2000U)
105 
109 #define GNRC_GOMACH_INTERNAL_INFO_MAX_PREAM_INTERV (0x4000U)
110 
114 #define GNRC_GOMACH_INTERNAL_INFO_RADIO_IS_ON (0x8000U)
115 
124 static inline void gnrc_gomach_set_tx_finish(gnrc_netif_t *netif, bool tx_finish)
125 {
126  if (tx_finish) {
128  }
129  else {
131  }
132 }
133 
142 static inline bool gnrc_gomach_get_tx_finish(gnrc_netif_t *netif)
143 {
144  return (netif->mac.mac_info & GNRC_GOMACH_INFO_TX_FINISHED);
145 }
146 
155 static inline void gnrc_gomach_set_pkt_received(gnrc_netif_t *netif, bool received)
156 {
157  if (received) {
159  }
160  else {
162  }
163 }
164 
173 static inline bool gnrc_gomach_get_pkt_received(gnrc_netif_t *netif)
174 {
175  return (netif->mac.mac_info & GNRC_GOMACH_INFO_PKT_RECEIVED);
176 }
177 
186 static inline void gnrc_gomach_set_quit_cycle(gnrc_netif_t *netif, bool quit)
187 {
188  if (quit) {
189  netif->mac.prot.gomach.gomach_info |= GNRC_GOMACH_INTERNAL_INFO_QUIT_CYCLE;
190  }
191  else {
192  netif->mac.prot.gomach.gomach_info &= ~GNRC_GOMACH_INTERNAL_INFO_QUIT_CYCLE;
193  }
194 }
195 
204 static inline bool gnrc_gomach_get_quit_cycle(gnrc_netif_t *netif)
205 {
206  return (netif->mac.prot.gomach.gomach_info & GNRC_GOMACH_INTERNAL_INFO_QUIT_CYCLE);
207 }
208 
217 static inline void gnrc_gomach_set_got_preamble(gnrc_netif_t *netif, bool got_preamble)
218 {
219  if (got_preamble) {
220  netif->mac.prot.gomach.gomach_info |= GNRC_GOMACH_INTERNAL_INFO_GOT_PREAMBLE;
221  }
222  else {
223  netif->mac.prot.gomach.gomach_info &= ~GNRC_GOMACH_INTERNAL_INFO_GOT_PREAMBLE;
224  }
225 }
226 
235 static inline bool gnrc_gomach_get_got_preamble(gnrc_netif_t *netif)
236 {
237  return (netif->mac.prot.gomach.gomach_info & GNRC_GOMACH_INTERNAL_INFO_GOT_PREAMBLE);
238 }
239 
248 static inline void gnrc_gomach_set_cp_end(gnrc_netif_t *netif, bool cp_end)
249 {
250  if (cp_end) {
251  netif->mac.prot.gomach.gomach_info |= GNRC_GOMACH_INTERNAL_INFO_CP_END;
252  }
253  else {
254  netif->mac.prot.gomach.gomach_info &= ~GNRC_GOMACH_INTERNAL_INFO_CP_END;
255  }
256 }
257 
266 static inline bool gnrc_gomach_get_cp_end(gnrc_netif_t *netif)
267 {
268  return (netif->mac.prot.gomach.gomach_info & GNRC_GOMACH_INTERNAL_INFO_CP_END);
269 }
270 
279 static inline void gnrc_gomach_set_vTDMA_end(gnrc_netif_t *netif, bool vtdma_end)
280 {
281  if (vtdma_end) {
282  netif->mac.prot.gomach.gomach_info |= GNRC_GOMACH_INTERNAL_INFO_VTDMA_END;
283  }
284  else {
285  netif->mac.prot.gomach.gomach_info &= ~GNRC_GOMACH_INTERNAL_INFO_VTDMA_END;
286  }
287 }
288 
297 static inline bool gnrc_gomach_get_vTDMA_end(gnrc_netif_t *netif)
298 {
299  return (netif->mac.prot.gomach.gomach_info & GNRC_GOMACH_INTERNAL_INFO_VTDMA_END);
300 }
301 
310 static inline void gnrc_gomach_set_unintd_preamble(gnrc_netif_t *netif, bool uintd_preamble)
311 {
312  if (uintd_preamble) {
313  netif->mac.prot.gomach.gomach_info |= GNRC_GOMACH_INTERNAL_INFO_UNINTD_PREAMBLE;
314  }
315  else {
316  netif->mac.prot.gomach.gomach_info &= ~GNRC_GOMACH_INTERNAL_INFO_UNINTD_PREAMBLE;
317  }
318 }
319 
329 {
330  return (netif->mac.prot.gomach.gomach_info & GNRC_GOMACH_INTERNAL_INFO_UNINTD_PREAMBLE);
331 }
332 
341 static inline void gnrc_gomach_set_update(gnrc_netif_t *netif, bool update)
342 {
343  if (update) {
344  netif->mac.prot.gomach.gomach_info |= GNRC_GOMACH_INTERNAL_INFO_ND_UPDATE;
345  }
346  else {
347  netif->mac.prot.gomach.gomach_info &= ~GNRC_GOMACH_INTERNAL_INFO_ND_UPDATE;
348  }
349 }
350 
359 static inline bool gnrc_gomach_get_update(gnrc_netif_t *netif)
360 {
361  return (netif->mac.prot.gomach.gomach_info & GNRC_GOMACH_INTERNAL_INFO_ND_UPDATE);
362 }
363 
372 static inline void gnrc_gomach_set_duty_cycle_start(gnrc_netif_t *netif, bool start)
373 {
374  if (start) {
375  netif->mac.prot.gomach.gomach_info |= GNRC_GOMACH_INTERNAL_INFO_DUTY_CYCLE_START;
376  }
377  else {
378  netif->mac.prot.gomach.gomach_info &= ~GNRC_GOMACH_INTERNAL_INFO_DUTY_CYCLE_START;
379  }
380 }
381 
391 {
392  return (netif->mac.prot.gomach.gomach_info & GNRC_GOMACH_INTERNAL_INFO_DUTY_CYCLE_START);
393 }
394 
403 static inline void gnrc_gomach_set_phase_backoff(gnrc_netif_t *netif, bool backoff)
404 {
405  if (backoff) {
406  netif->mac.prot.gomach.gomach_info |= GNRC_GOMACH_INTERNAL_INFO_PHASE_BACKOFF;
407  }
408  else {
409  netif->mac.prot.gomach.gomach_info &= ~GNRC_GOMACH_INTERNAL_INFO_PHASE_BACKOFF;
410  }
411 }
412 
421 static inline bool gnrc_gomach_get_phase_backoff(gnrc_netif_t *netif)
422 {
423  return (netif->mac.prot.gomach.gomach_info & GNRC_GOMACH_INTERNAL_INFO_PHASE_BACKOFF);
424 }
425 
434 static inline void gnrc_gomach_set_beacon_fail(gnrc_netif_t *netif, bool fail)
435 {
436  if (fail) {
437  netif->mac.prot.gomach.gomach_info |= GNRC_GOMACH_INTERNAL_INFO_BEACON_FAIL;
438  }
439  else {
440  netif->mac.prot.gomach.gomach_info &= ~GNRC_GOMACH_INTERNAL_INFO_BEACON_FAIL;
441  }
442 }
443 
452 static inline bool gnrc_gomach_get_beacon_fail(gnrc_netif_t *netif)
453 {
454  return (netif->mac.prot.gomach.gomach_info & GNRC_GOMACH_INTERNAL_INFO_BEACON_FAIL);
455 }
456 
465 static inline void gnrc_gomach_set_buffer_full(gnrc_netif_t *netif, bool full)
466 {
467  if (full) {
468  netif->mac.prot.gomach.gomach_info |= GNRC_GOMACH_INTERNAL_INFO_BUFFER_FULL;
469  }
470  else {
471  netif->mac.prot.gomach.gomach_info &= ~GNRC_GOMACH_INTERNAL_INFO_BUFFER_FULL;
472  }
473 }
474 
483 static inline bool gnrc_gomach_get_buffer_full(gnrc_netif_t *netif)
484 {
485  return (netif->mac.prot.gomach.gomach_info & GNRC_GOMACH_INTERNAL_INFO_BUFFER_FULL);
486 }
487 
496 static inline void gnrc_gomach_set_enter_new_cycle(gnrc_netif_t *netif, bool enter)
497 {
498  if (enter) {
499  netif->mac.prot.gomach.gomach_info |= GNRC_GOMACH_INTERNAL_INFO_ENTER_NEW_CYCLE;
500  }
501  else {
502  netif->mac.prot.gomach.gomach_info &= ~GNRC_GOMACH_INTERNAL_INFO_ENTER_NEW_CYCLE;
503  }
504 }
505 
515 {
516  return (netif->mac.prot.gomach.gomach_info & GNRC_GOMACH_INTERNAL_INFO_ENTER_NEW_CYCLE);
517 }
518 
527 static inline void gnrc_gomach_set_got_preamble_ack(gnrc_netif_t *netif, bool got)
528 {
529  if (got) {
530  netif->mac.prot.gomach.gomach_info |= GNRC_GOMACH_INTERNAL_INFO_GOT_PREAMBLEACK;
531  }
532  else {
533  netif->mac.prot.gomach.gomach_info &= ~GNRC_GOMACH_INTERNAL_INFO_GOT_PREAMBLEACK;
534  }
535 }
536 
546 {
547  return (netif->mac.prot.gomach.gomach_info & GNRC_GOMACH_INTERNAL_INFO_GOT_PREAMBLEACK);
548 }
549 
558 static inline void gnrc_gomach_set_on_pubchan_1(gnrc_netif_t *netif, bool on_pubchan_1)
559 {
560  if (on_pubchan_1) {
561  netif->mac.prot.gomach.gomach_info |= GNRC_GOMACH_INTERNAL_INFO_ON_PUBCHAN_1;
562  }
563  else {
564  netif->mac.prot.gomach.gomach_info &= ~GNRC_GOMACH_INTERNAL_INFO_ON_PUBCHAN_1;
565  }
566 }
567 
576 static inline bool gnrc_gomach_get_on_pubchan_1(gnrc_netif_t *netif)
577 {
578  return (netif->mac.prot.gomach.gomach_info & GNRC_GOMACH_INTERNAL_INFO_ON_PUBCHAN_1);
579 }
580 
589 static inline void gnrc_gomach_set_max_pream_interv(gnrc_netif_t *netif, bool max)
590 {
591  if (max) {
592  netif->mac.prot.gomach.gomach_info |= GNRC_GOMACH_INTERNAL_INFO_MAX_PREAM_INTERV;
593  }
594  else {
595  netif->mac.prot.gomach.gomach_info &= ~GNRC_GOMACH_INTERNAL_INFO_MAX_PREAM_INTERV;
596  }
597 }
598 
608 {
609  return (netif->mac.prot.gomach.gomach_info & GNRC_GOMACH_INTERNAL_INFO_MAX_PREAM_INTERV);
610 }
611 
619 uint64_t gnrc_gomach_phase_now(gnrc_netif_t *netif);
620 
628 
636 static inline void gnrc_gomach_set_autoack(gnrc_netif_t *netif, netopt_enable_t autoack)
637 {
638  assert(netif != NULL);
639 
640  netif->dev->driver->set(netif->dev,
642  &autoack,
643  sizeof(autoack));
644 }
645 
653 static inline void gnrc_gomach_set_ack_req(gnrc_netif_t *netif, netopt_enable_t ack_req)
654 {
655  assert(netif != NULL);
656 
657  netif->dev->driver->set(netif->dev,
659  &ack_req,
660  sizeof(ack_req));
661 }
662 
672 {
673  assert(netif != NULL);
674 
675  netopt_state_t state;
676 
677  if (0 < netif->dev->driver->get(netif->dev,
678  NETOPT_STATE,
679  &state,
680  sizeof(state))) {
681  return state;
682  }
683  return -ENOSYS;
684 }
685 
693 static inline void gnrc_gomach_turn_channel(gnrc_netif_t *netif, uint16_t channel_num)
694 {
695  assert(netif != NULL);
696 
697  netif->dev->driver->set(netif->dev,
699  &channel_num,
700  sizeof(channel_num));
701 }
702 
726 
737 
748 int gnrc_gomach_send(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt, netopt_enable_t csma_enable);
749 
760 
770 
781 
791  gnrc_gomach_packet_info_t *pa_info);
792 
800 
808 
819 
830 
839 
847 
857 int gnrc_gomach_send_data(gnrc_netif_t *netif, netopt_enable_t csma_enable);
858 
869 
878 
887 
895 
903 
911 
912 #ifdef __cplusplus
913 }
914 #endif
915 
916 #endif /* GOMACH_INTERNAL_H */
917 
gnrc_gomach_get_got_preamble_ack
static bool gnrc_gomach_get_got_preamble_ack(gnrc_netif_t *netif)
Get the GNRC_GOMACH_INTERNAL_INFO_GOT_PREAMBLEACK flag of the device.
Definition: gomach_internal.h:545
netdev::driver
const struct netdev_driver * driver
ptr to that driver's interface.
Definition: netdev.h:303
gnrc_gomach_turn_channel
static void gnrc_gomach_turn_channel(gnrc_netif_t *netif, uint16_t channel_num)
Turn the radio to a specific channel.
Definition: gomach_internal.h:693
netopt_enable_t
netopt_enable_t
Binary parameter for enabling and disabling options.
Definition: netopt.h:796
gnrc_gomach_get_cp_end
static bool gnrc_gomach_get_cp_end(gnrc_netif_t *netif)
Get the GNRC_GOMACH_INTERNAL_INFO_CP_END flag of the device.
Definition: gomach_internal.h:266
gnrc_gomach_send_beacon
int gnrc_gomach_send_beacon(gnrc_netif_t *netif)
Broadcast a beacon packet in GoMacH.
gnrc_netif_t::mac
gnrc_netif_mac_t mac
Common MAC module component
Definition: netif.h:130
gnrc_gomach_get_unintd_preamble
static bool gnrc_gomach_get_unintd_preamble(gnrc_netif_t *netif)
Get the GNRC_GOMACH_INTERNAL_INFO_UNINTD_PREAMBLE flag of the device.
Definition: gomach_internal.h:328
gnrc_gomach_set_max_pream_interv
static void gnrc_gomach_set_max_pream_interv(gnrc_netif_t *netif, bool max)
Set the GNRC_GOMACH_INTERNAL_INFO_MAX_PREAM_INTERV flag of the device.
Definition: gomach_internal.h:589
gnrc_gomach_set_quit_cycle
static void gnrc_gomach_set_quit_cycle(gnrc_netif_t *netif, bool quit)
Set the GNRC_GOMACH_INTERNAL_INFO_QUIT_CYCLE flag of the device.
Definition: gomach_internal.h:186
gnrc_gomach_dispatch_defer
int gnrc_gomach_dispatch_defer(gnrc_pktsnip_t *buffer[], gnrc_pktsnip_t *pkt)
Store the received packet to the dispatch buffer.
GNRC_GOMACH_INTERNAL_INFO_CP_END
#define GNRC_GOMACH_INTERNAL_INFO_CP_END
Flag to track if CP period has ended in GoMacH.
Definition: gomach_internal.h:54
GNRC_GOMACH_INTERNAL_INFO_ND_UPDATE
#define GNRC_GOMACH_INTERNAL_INFO_ND_UPDATE
Flag to track if need to update GoMacH.
Definition: gomach_internal.h:44
assert
#define assert(cond)
abort the program if assertion is false
Definition: assert.h:104
NETOPT_STATE
@ NETOPT_STATE
(netopt_state_t) state of network device
Definition: netopt.h:245
gnrc_gomach_indicator_update
void gnrc_gomach_indicator_update(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt, gnrc_gomach_packet_info_t *pa_info)
Update the queue-length indicator of the packet sender.
GNRC_GOMACH_INTERNAL_INFO_ENTER_NEW_CYCLE
#define GNRC_GOMACH_INTERNAL_INFO_ENTER_NEW_CYCLE
Flag to track if node has entered a new cycle in GoMacH.
Definition: gomach_internal.h:94
gnrc_gomach_process_pkt_in_wait_preamble_ack
void gnrc_gomach_process_pkt_in_wait_preamble_ack(gnrc_netif_t *netif)
Process the received packets to when waiting for the preamble-ACK packet.
GNRC_GOMACH_INTERNAL_INFO_BUFFER_FULL
#define GNRC_GOMACH_INTERNAL_INFO_BUFFER_FULL
Flag to track if node's packet buffer is full in GoMacH.
Definition: gomach_internal.h:89
gnrc_gomach_get_on_pubchan_1
static bool gnrc_gomach_get_on_pubchan_1(gnrc_netif_t *netif)
Get the GNRC_GOMACH_INTERNAL_INFO_ON_PUBCHAN_1 flag of the device.
Definition: gomach_internal.h:576
gnrc_gomach_get_buffer_full
static bool gnrc_gomach_get_buffer_full(gnrc_netif_t *netif)
Get the GNRC_GOMACH_INTERNAL_INFO_BUFFER_FULL flag of the device.
Definition: gomach_internal.h:483
gnrc_gomach_set_vTDMA_end
static void gnrc_gomach_set_vTDMA_end(gnrc_netif_t *netif, bool vtdma_end)
Set the GNRC_GOMACH_INTERNAL_INFO_VTDMA_END flag of the device.
Definition: gomach_internal.h:279
netdev_driver::set
int(* set)(netdev_t *dev, netopt_t opt, const void *value, size_t value_len)
Set an option value for a given network device.
Definition: netdev.h:476
gnrc_gomach_packet_info_t
Type to pass information about packet parsing.
Definition: types.h:242
gnrc_gomach_send
int gnrc_gomach_send(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt, netopt_enable_t csma_enable)
Send a pktsnip in GoMacH.
gnrc_gomach_get_max_pream_interv
static bool gnrc_gomach_get_max_pream_interv(gnrc_netif_t *netif)
Get the GNRC_GOMACH_INTERNAL_INFO_MAX_PREAM_INTERV flag of the device.
Definition: gomach_internal.h:607
gnrc_gomach_set_on_pubchan_1
static void gnrc_gomach_set_on_pubchan_1(gnrc_netif_t *netif, bool on_pubchan_1)
Set the GNRC_GOMACH_INTERNAL_INFO_ON_PUBCHAN_1 flag of the device.
Definition: gomach_internal.h:558
GNRC_GOMACH_INTERNAL_INFO_PHASE_BACKOFF
#define GNRC_GOMACH_INTERNAL_INFO_PHASE_BACKOFF
Flag to track if node need to backoff its phase in GoMacH.
Definition: gomach_internal.h:79
GNRC_GOMACH_INTERNAL_INFO_GOT_PREAMBLEACK
#define GNRC_GOMACH_INTERNAL_INFO_GOT_PREAMBLEACK
Flag to track if node has got preamble-ACK in GoMacH.
Definition: gomach_internal.h:99
gnrc_gomach_send_data
int gnrc_gomach_send_data(gnrc_netif_t *netif, netopt_enable_t csma_enable)
Send a data packet to the targeted neighbor.
gnrc_gomach_get_netdev_state
static netopt_state_t gnrc_gomach_get_netdev_state(gnrc_netif_t *netif)
Shortcut to get the state of netdev.
Definition: gomach_internal.h:671
gnrc_gomach_cp_packet_process
void gnrc_gomach_cp_packet_process(gnrc_netif_t *netif)
Process packets received during the CP (wake-up) period of GoMacH.
gnrc_gomach_set_got_preamble
static void gnrc_gomach_set_got_preamble(gnrc_netif_t *netif, bool got_preamble)
Set the GNRC_GOMACH_INTERNAL_INFO_GOT_PREAMBLE flag of the device.
Definition: gomach_internal.h:217
gnrc_gomach_get_tx_finish
static bool gnrc_gomach_get_tx_finish(gnrc_netif_t *netif)
Get the GNRC_GOMACH_INFO_TX_FINISHED flag of the device.
Definition: gomach_internal.h:142
gnrc_gomach_set_buffer_full
static void gnrc_gomach_set_buffer_full(gnrc_netif_t *netif, bool full)
Set the GNRC_GOMACH_INTERNAL_INFO_BUFFER_FULL flag of the device.
Definition: gomach_internal.h:465
gnrc_gomach_set_autoack
static void gnrc_gomach_set_autoack(gnrc_netif_t *netif, netopt_enable_t autoack)
Set the auto-ACK parameter of the device.
Definition: gomach_internal.h:636
rtt.h
Low-level RTT (Real Time Timer) peripheral driver interface definitions.
gnrc_gomach_bcast_subchann_seq
int gnrc_gomach_bcast_subchann_seq(gnrc_netif_t *netif, netopt_enable_t use_csma)
Broadcast the chosen sub-channel sequence to the device's neighbors.
gnrc_gomach_set_update
static void gnrc_gomach_set_update(gnrc_netif_t *netif, bool update)
Set the GNRC_GOMACH_INTERNAL_INFO_ND_UPDATE flag of the device.
Definition: gomach_internal.h:341
gnrc_gomach_send_preamble
int gnrc_gomach_send_preamble(gnrc_netif_t *netif, netopt_enable_t csma_enable)
Send a preamble packet to the targeted neighbor.
gnrc_gomach_set_enter_new_cycle
static void gnrc_gomach_set_enter_new_cycle(gnrc_netif_t *netif, bool enter)
Set the GNRC_GOMACH_INTERNAL_INFO_ENTER_NEW_CYCLE flag of the device.
Definition: gomach_internal.h:496
gnrc_gomach_set_unintd_preamble
static void gnrc_gomach_set_unintd_preamble(gnrc_netif_t *netif, bool uintd_preamble)
Set the GNRC_GOMACH_INTERNAL_INFO_UNINTD_PREAMBLE flag of the device.
Definition: gomach_internal.h:310
GNRC_GOMACH_INTERNAL_INFO_GOT_PREAMBLE
#define GNRC_GOMACH_INTERNAL_INFO_GOT_PREAMBLE
Flag to track if need to quit the current cycle in GoMacH.
Definition: gomach_internal.h:69
GNRC_GOMACH_INTERNAL_INFO_MAX_PREAM_INTERV
#define GNRC_GOMACH_INTERNAL_INFO_MAX_PREAM_INTERV
Flag to track if node has reached maximum preamble interval.
Definition: gomach_internal.h:109
gnrc_gomach_get_got_preamble
static bool gnrc_gomach_get_got_preamble(gnrc_netif_t *netif)
Get the GNRC_GOMACH_INTERNAL_INFO_GOT_PREAMBLE flag of the device.
Definition: gomach_internal.h:235
netopt_state_t
netopt_state_t
Option parameter to be used with NETOPT_STATE to set or get the state of a network device or protocol...
Definition: netopt.h:805
gnrc_gomach_beacon_process
void gnrc_gomach_beacon_process(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt)
Process the received beacon packet.
gnrc_gomach_get_pkt_received
static bool gnrc_gomach_get_pkt_received(gnrc_netif_t *netif)
Get the GNRC_GOMACH_INFO_PKT_RECEIVED flag of the device.
Definition: gomach_internal.h:173
gnrc_gomach_set_got_preamble_ack
static void gnrc_gomach_set_got_preamble_ack(gnrc_netif_t *netif, bool got)
Set the GNRC_GOMACH_INTERNAL_INFO_GOT_PREAMBLEACK flag of the device.
Definition: gomach_internal.h:527
gnrc_netif_t
Representation of a network interface.
Definition: netif.h:115
gnrc_gomach_get_beacon_fail
static bool gnrc_gomach_get_beacon_fail(gnrc_netif_t *netif)
Get the GNRC_GOMACH_INTERNAL_INFO_BEACON_FAIL flag of the device.
Definition: gomach_internal.h:452
gnrc_gomach_get_duty_cycle_start
static bool gnrc_gomach_get_duty_cycle_start(gnrc_netif_t *netif)
Get the GNRC_GOMACH_INTERNAL_INFO_DUTY_CYCLE_START flag of the device.
Definition: gomach_internal.h:390
GNRC_GOMACH_INTERNAL_INFO_ON_PUBCHAN_1
#define GNRC_GOMACH_INTERNAL_INFO_ON_PUBCHAN_1
Flag to track if node's radio is on public-channel-1.
Definition: gomach_internal.h:104
gnrc_gomach_get_vTDMA_end
static bool gnrc_gomach_get_vTDMA_end(gnrc_netif_t *netif)
Get the GNRC_GOMACH_INTERNAL_INFO_VTDMA_END flag of the device.
Definition: gomach_internal.h:297
gnrc_gomach_get_update
static bool gnrc_gomach_get_update(gnrc_netif_t *netif)
Get the GNRC_GOMACH_INTERNAL_INFO_ND_UPDATE flag of the device.
Definition: gomach_internal.h:359
gnrc_gomach_set_beacon_fail
static void gnrc_gomach_set_beacon_fail(gnrc_netif_t *netif, bool fail)
Set the GNRC_GOMACH_INTERNAL_INFO_BEACON_FAIL flag of the device.
Definition: gomach_internal.h:434
GNRC_GOMACH_INTERNAL_INFO_DUTY_CYCLE_START
#define GNRC_GOMACH_INTERNAL_INFO_DUTY_CYCLE_START
Flag to track if node's duty-cycle has started in GoMacH.
Definition: gomach_internal.h:74
gnrc_gomach_init_choose_subchannel
void gnrc_gomach_init_choose_subchannel(gnrc_netif_t *netif)
Choose a sub-channel for a device running GoMacH.
GNRC_GOMACH_INFO_TX_FINISHED
#define GNRC_GOMACH_INFO_TX_FINISHED
Flag to track if the transmission has finished.
Definition: gomach_internal.h:34
GNRC_GOMACH_INTERNAL_INFO_UNINTD_PREAMBLE
#define GNRC_GOMACH_INTERNAL_INFO_UNINTD_PREAMBLE
Flag to track if the node has received unintended preamble.
Definition: gomach_internal.h:64
gnrc_gomach_set_phase_backoff
static void gnrc_gomach_set_phase_backoff(gnrc_netif_t *netif, bool backoff)
Set the GNRC_GOMACH_INTERNAL_INFO_PHASE_BACKOFF flag of the device.
Definition: gomach_internal.h:403
GNRC_GOMACH_INTERNAL_INFO_BEACON_FAIL
#define GNRC_GOMACH_INTERNAL_INFO_BEACON_FAIL
Flag to track if beacon transmission fail in GoMacH.
Definition: gomach_internal.h:84
gnrc_netif_mac_t::mac_info
uint16_t mac_info
general information for the MAC protocol
Definition: mac.h:76
gnrc_netif_t::dev
netdev_t * dev
Network device of the network interface.
Definition: netif.h:118
ENOSYS
#define ENOSYS
Function not supported.
Definition: errno.h:124
gnrc_gomach_set_netdev_state
void gnrc_gomach_set_netdev_state(gnrc_netif_t *netif, netopt_state_t devstate)
Shortcut to set the state of netdev.
gnrc_gomach_set_duty_cycle_start
static void gnrc_gomach_set_duty_cycle_start(gnrc_netif_t *netif, bool start)
Set the GNRC_GOMACH_INTERNAL_INFO_DUTY_CYCLE_START flag of the device.
Definition: gomach_internal.h:372
gnrc_gomach_update_neighbor_pubchan
void gnrc_gomach_update_neighbor_pubchan(gnrc_netif_t *netif)
Update the TX neighbors' public channel phase in GoMacH.
gnrc_gomach_packet_process_in_wait_beacon
void gnrc_gomach_packet_process_in_wait_beacon(gnrc_netif_t *netif)
Process the received packets when waiting for the beacon during t2k procedure in GoMacH.
gnrc_gomach_phase_now
uint64_t gnrc_gomach_phase_now(gnrc_netif_t *netif)
Get device's current phase.
gnrc_gomach_set_cp_end
static void gnrc_gomach_set_cp_end(gnrc_netif_t *netif, bool cp_end)
Set the GNRC_GOMACH_INTERNAL_INFO_CP_END flag of the device.
Definition: gomach_internal.h:248
gnrc_gomach_set_pkt_received
static void gnrc_gomach_set_pkt_received(gnrc_netif_t *netif, bool received)
Set the GNRC_GOMACH_INFO_PKT_RECEIVED flag of the device.
Definition: gomach_internal.h:155
netif.h
Definition for GNRC's network interfaces.
NETOPT_AUTOACK
@ NETOPT_AUTOACK
(netopt_enable_t) automatic link layer ACKs
Definition: netopt.h:219
NETOPT_CHANNEL
@ NETOPT_CHANNEL
(uint16_t) channel number
Definition: netopt.h:54
gnrc_gomach_process_preamble_ack
void gnrc_gomach_process_preamble_ack(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt)
Process the received preamble-ACK packet to get phase-locked with the sender.
gnrc_gomach_get_quit_cycle
static bool gnrc_gomach_get_quit_cycle(gnrc_netif_t *netif)
Get the GNRC_GOMACH_INTERNAL_INFO_QUIT_CYCLE flag of the device.
Definition: gomach_internal.h:204
gnrc_gomach_send_preamble_ack
int gnrc_gomach_send_preamble_ack(gnrc_netif_t *netif, gnrc_gomach_packet_info_t *info)
Reply a preamble-ACK packet in GoMacH.
GNRC_GOMACH_INTERNAL_INFO_QUIT_CYCLE
#define GNRC_GOMACH_INTERNAL_INFO_QUIT_CYCLE
Flag to track if need to quit the current cycle in GoMacH.
Definition: gomach_internal.h:49
gnrc_gomach_get_enter_new_cycle
static bool gnrc_gomach_get_enter_new_cycle(gnrc_netif_t *netif)
Get the GNRC_GOMACH_INTERNAL_INFO_ENTER_NEW_CYCLE flag of the device.
Definition: gomach_internal.h:514
GNRC_GOMACH_INFO_PKT_RECEIVED
#define GNRC_GOMACH_INFO_PKT_RECEIVED
Flag to track if a packet has been successfully received.
Definition: gomach_internal.h:39
gnrc_gomach_get_phase_backoff
static bool gnrc_gomach_get_phase_backoff(gnrc_netif_t *netif)
Get the GNRC_GOMACH_INTERNAL_INFO_PHASE_BACKOFF flag of the device.
Definition: gomach_internal.h:421
gnrc_gomach_check_duplicate
bool gnrc_gomach_check_duplicate(gnrc_netif_t *netif, gnrc_gomach_packet_info_t *pa_info)
Check if the received packet is a duplicate packet.
gnrc_gomach_set_ack_req
static void gnrc_gomach_set_ack_req(gnrc_netif_t *netif, netopt_enable_t ack_req)
Set the ACK-require parameter of the device.
Definition: gomach_internal.h:653
gnrc_gomach_packet_process_in_vtdma
void gnrc_gomach_packet_process_in_vtdma(gnrc_netif_t *netif)
Process the received packets in the vTDMA period in GoMacH.
gnrc_gomach_update_neighbor_phase
void gnrc_gomach_update_neighbor_phase(gnrc_netif_t *netif)
Update the TX neighbors' phases in GoMacH.
gnrc_pktsnip
Type to represent parts (either headers or payload) of a packet, called snips.
Definition: pkt.h:108
GNRC_GOMACH_INTERNAL_INFO_VTDMA_END
#define GNRC_GOMACH_INTERNAL_INFO_VTDMA_END
Flag to track if vTDMA has ended in GoMacH.
Definition: gomach_internal.h:59
netdev_driver::get
int(* get)(netdev_t *dev, netopt_t opt, void *value, size_t max_len)
Get an option value from a given network device.
Definition: netdev.h:450
gnrc_gomach_set_tx_finish
static void gnrc_gomach_set_tx_finish(gnrc_netif_t *netif, bool tx_finish)
Set the GNRC_GOMACH_INFO_TX_FINISHED flag of the device.
Definition: gomach_internal.h:124
_gnrc_gomach_transmit
int _gnrc_gomach_transmit(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt)
send a packet over the network interface in GoMacH
gnrc_gomach_find_next_tx_neighbor
bool gnrc_gomach_find_next_tx_neighbor(gnrc_netif_t *netif)
Find a neighbor that is next to send packet to.
NETOPT_ACK_REQ
@ NETOPT_ACK_REQ
(netopt_enable_t) acknowledgement request on outgoing frames
Definition: netopt.h:233