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 
10 #pragma once
11 
23 #include <stdint.h>
24 
25 #include "net/ieee802154.h"
26 #include "net/gnrc/netif.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
41 static inline bool gnrc_netif_get_rx_started(gnrc_netif_t *netif)
42 {
44 }
45 
54 static inline void gnrc_netif_set_rx_started(gnrc_netif_t *netif, bool rx_started)
55 {
56  if (rx_started) {
58  }
59  else {
61  }
62 }
63 
72 {
73  return (gnrc_mac_tx_feedback_t)(netif->mac.mac_info &
75 }
76 
85 static inline void gnrc_netif_set_tx_feedback(gnrc_netif_t *netif,
87 {
88  /* check if gnrc_mac_tx_feedback does not collide with
89  * GNRC_NETIF_MAC_INFO_RX_STARTED */
91  /* unset previous value */
93  netif->mac.mac_info |= (uint16_t)(txf & GNRC_NETIF_MAC_INFO_TX_FEEDBACK_MASK);
94 }
95 
96 #if (GNRC_MAC_TX_QUEUE_SIZE != 0) || defined(DOXYGEN)
114 bool gnrc_mac_queue_tx_packet(gnrc_mac_tx_t *tx, uint32_t priority, gnrc_pktsnip_t *pkt);
115 #endif /* (GNRC_MAC_TX_QUEUE_SIZE != 0) || defined(DOXYGEN) */
116 
117 #if (GNRC_MAC_RX_QUEUE_SIZE != 0) || defined(DOXYGEN)
127 bool gnrc_mac_queue_rx_packet(gnrc_mac_rx_t *rx, uint32_t priority, gnrc_pktsnip_t *pkt);
128 #endif /* (GNRC_MAC_RX_QUEUE_SIZE != 0) || defined(DOXYGEN) */
129 
130 #if (GNRC_MAC_DISPATCH_BUFFER_SIZE != 0) || defined(DOXYGEN)
137 #endif /* (GNRC_MAC_DISPATCH_BUFFER_SIZE != 0) || defined(DOXYGEN) */
138 
139 #ifdef __cplusplus
140 }
141 #endif
142 
#define assert(cond)
abort the program if assertion is false
Definition: assert.h:135
Definition for GNRC's network interfaces.
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:85
static bool gnrc_netif_get_rx_started(gnrc_netif_t *netif)
get the 'rx_started' state of the device
Definition: internal.h:41
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.
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:71
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 void gnrc_netif_set_rx_started(gnrc_netif_t *netif, bool rx_started)
set the rx_started state of the device
Definition: internal.h:54
void gnrc_mac_dispatch(gnrc_mac_rx_t *rx)
Dispatch all the packets stored in netdev_t::rx:dispatch_buffer to upper layer.
#define GNRC_NETIF_MAC_INFO_RX_STARTED
Flag to track if a transmission might have corrupted a received packet.
Definition: mac.h:37
#define GNRC_NETIF_MAC_INFO_TX_FEEDBACK_MASK
Mask for gnrc_mac_tx_feedback_t.
Definition: mac.h:31
MAC internal type for storing reception state parameters and state machines.
Definition: types.h:69
MAC internal type for storing transmission state parameters and state machines.
Definition: types.h:171
uint16_t mac_info
general information for the MAC protocol
Definition: mac.h:76
Representation of a network interface.
Definition: netif.h:135
gnrc_netif_mac_t mac
Common MAC module component
Definition: netif.h:150
Type to represent parts (either headers or payload) of a packet, called snips.
Definition: pkt.h:108
gnrc_mac_tx_feedback_t
definition for device transmission feedback types
Definition: types.h:49
IEEE 802.15.4 header definitions.