Loading...
Searching...
No Matches
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
30extern "C" {
31#endif
32
42static inline bool gnrc_netif_get_rx_started(gnrc_netif_t *netif)
43{
45}
46
55static inline void gnrc_netif_set_rx_started(gnrc_netif_t *netif, bool rx_started)
56{
57 if (rx_started) {
59 }
60 else {
61 netif->mac.mac_info &= ~GNRC_NETIF_MAC_INFO_RX_STARTED;
62 }
63}
64
77
86static 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 */
93 netif->mac.mac_info &= ~GNRC_NETIF_MAC_INFO_TX_FEEDBACK_MASK;
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)
115bool 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)
128bool 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)
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 */
#define assert(cond)
abort the program if assertion is false
Definition assert.h:136
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:86
static bool gnrc_netif_get_rx_started(gnrc_netif_t *netif)
get the 'rx_started' state of the device
Definition internal.h:42
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:72
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:55
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:70
MAC internal type for storing transmission state parameters and state machines.
Definition types.h:172
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:50
IEEE 802.15.4 header definitions.