mac/internal.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_INTERNAL_H
22 #define NET_GNRC_MAC_INTERNAL_H
23 
24 #include <stdint.h>
25 
26 #include "net/ieee802154.h"
27 #include "net/gnrc/netif.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
42 static inline bool gnrc_netif_get_rx_started(gnrc_netif_t *netif)
43 {
45 }
46 
55 static inline void gnrc_netif_set_rx_started(gnrc_netif_t *netif, bool rx_started)
56 {
57  if (rx_started) {
59  }
60  else {
62  }
63 }
64 
73 {
74  return (gnrc_mac_tx_feedback_t)(netif->mac.mac_info &
76 }
77 
86 static inline void gnrc_netif_set_tx_feedback(gnrc_netif_t *netif,
88 {
89  /* check if gnrc_mac_tx_feedback does not collide with
90  * GNRC_NETIF_MAC_INFO_RX_STARTED */
92  /* unset previous value */
94  netif->mac.mac_info |= (uint16_t)(txf & GNRC_NETIF_MAC_INFO_TX_FEEDBACK_MASK);
95 }
96 
97 #if (GNRC_MAC_TX_QUEUE_SIZE != 0) || defined(DOXYGEN)
98 
115 bool gnrc_mac_queue_tx_packet(gnrc_mac_tx_t *tx, uint32_t priority, gnrc_pktsnip_t *pkt);
116 #endif /* (GNRC_MAC_TX_QUEUE_SIZE != 0) || defined(DOXYGEN) */
117 
118 #if (GNRC_MAC_RX_QUEUE_SIZE != 0) || defined(DOXYGEN)
119 
128 bool gnrc_mac_queue_rx_packet(gnrc_mac_rx_t *rx, uint32_t priority, gnrc_pktsnip_t *pkt);
129 #endif /* (GNRC_MAC_RX_QUEUE_SIZE != 0) || defined(DOXYGEN) */
130 
131 #if (GNRC_MAC_DISPATCH_BUFFER_SIZE != 0) || defined(DOXYGEN)
132 
138 #endif /* (GNRC_MAC_DISPATCH_BUFFER_SIZE != 0) || defined(DOXYGEN) */
139 
140 #ifdef __cplusplus
141 }
142 #endif
143 
144 #endif /* NET_GNRC_MAC_INTERNAL_H */
145 
gnrc_mac_tx_feedback_t
definition for device transmission feedback types
Definition: mac/types.h:46
static void gnrc_netif_set_tx_feedback(gnrc_netif_t *netif, gnrc_mac_tx_feedback_t txf)
set the transmission feedback of the device
Definition: mac/internal.h:86
bool gnrc_mac_queue_tx_packet(gnrc_mac_tx_t *tx, uint32_t priority, gnrc_pktsnip_t *pkt)
Queues the packet into the related transmission packet queue in netdev_t::tx.
static bool gnrc_netif_get_rx_started(gnrc_netif_t *netif)
get the &#39;rx_started&#39; state of the device
Definition: mac/internal.h:42
static gnrc_mac_tx_feedback_t gnrc_netif_get_tx_feedback(gnrc_netif_t *netif)
get the transmission feedback of the device
Definition: mac/internal.h:72
IEEE 802.15.4 header definitions.
#define assert(cond)
abort the program if assertion is false
Definition: assert.h:104
Definition for GNRC&#39;s network interfaces.
bool gnrc_mac_queue_rx_packet(gnrc_mac_rx_t *rx, uint32_t priority, gnrc_pktsnip_t *pkt)
Queues the packet into the reception packet queue in netdev_t::rx.
#define GNRC_NETIF_MAC_INFO_RX_STARTED
Flag to track if a transmission might have corrupted a received packet.
Definition: netif/mac.h:37
Representation of a network interface.
Definition: netif.h:61
static void gnrc_netif_set_rx_started(gnrc_netif_t *netif, bool rx_started)
set the rx_started state of the device
Definition: mac/internal.h:55
MAC internal type for storing reception state parameters and state machines.
Definition: mac/types.h:66
void gnrc_mac_dispatch(gnrc_mac_rx_t *rx)
Dispatch all the packets stored in netdev_t::rx:dispatch_buffer to upper layer.
gnrc_netif_mac_t mac
Common MAC module component
Definition: netif.h:69
Type to represent parts (either headers or payload) of a packet, called snips.
#define GNRC_NETIF_MAC_INFO_TX_FEEDBACK_MASK
Mask for gnrc_mac_tx_feedback_t.
Definition: netif/mac.h:31
uint16_t mac_info
general information for the MAC protocol
Definition: netif/mac.h:76
MAC internal type for storing transmission state parameters and state machines.
Definition: mac/types.h:168