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 
ieee802154.h
IEEE 802.15.4 header definitions.
gnrc_netif_t::mac
gnrc_netif_mac_t mac
Common MAC module component
Definition: netif.h:130
gnrc_mac_queue_tx_packet
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.
assert
#define assert(cond)
abort the program if assertion is false
Definition: assert.h:104
gnrc_netif_get_rx_started
static bool gnrc_netif_get_rx_started(gnrc_netif_t *netif)
get the 'rx_started' state of the device
Definition: internal.h:42
gnrc_mac_rx_t
MAC internal type for storing reception state parameters and state machines.
Definition: types.h:71
gnrc_mac_tx_feedback_t
gnrc_mac_tx_feedback_t
definition for device transmission feedback types
Definition: types.h:51
gnrc_netif_set_tx_feedback
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: internal.h:86
gnrc_mac_tx_t
MAC internal type for storing transmission state parameters and state machines.
Definition: types.h:173
gnrc_netif_t
Representation of a network interface.
Definition: netif.h:115
gnrc_netif_set_rx_started
static void gnrc_netif_set_rx_started(gnrc_netif_t *netif, bool rx_started)
set the rx_started state of the device
Definition: internal.h:55
gnrc_netif_get_tx_feedback
static gnrc_mac_tx_feedback_t gnrc_netif_get_tx_feedback(gnrc_netif_t *netif)
get the transmission feedback of the device
Definition: internal.h:72
GNRC_NETIF_MAC_INFO_TX_FEEDBACK_MASK
#define GNRC_NETIF_MAC_INFO_TX_FEEDBACK_MASK
Mask for gnrc_mac_tx_feedback_t.
Definition: mac.h:31
gnrc_mac_queue_rx_packet
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.
gnrc_mac_dispatch
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_info
uint16_t mac_info
general information for the MAC protocol
Definition: mac.h:76
netif.h
Definition for GNRC's network interfaces.
gnrc_pktsnip
Type to represent parts (either headers or payload) of a packet, called snips.
Definition: pkt.h:108
GNRC_NETIF_MAC_INFO_RX_STARTED
#define GNRC_NETIF_MAC_INFO_RX_STARTED
Flag to track if a transmission might have corrupted a received packet.
Definition: mac.h:37