1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/sys/include/net/gnrc/netif/mac.h

115 lines
3.0 KiB
C
Raw Normal View History

/*
* Copyright (C) 2017 Freie Universität Berlin
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
2017-11-16 18:06:46 +01:00
* @ingroup net_gnrc_netif
* @{
*
* @file
2017-11-16 18:06:46 +01:00
* @brief @ref net_gnrc_mac definitions for @ref net_gnrc_netif
*
* @author Martine Lenders <mlenders@inf.fu-berlin.de>
*/
2017-11-16 18:06:46 +01:00
#ifndef NET_GNRC_NETIF_MAC_H
#define NET_GNRC_NETIF_MAC_H
#include "net/gnrc/mac/types.h"
2017-10-19 19:40:58 +02:00
#include "net/csma_sender.h"
#ifdef __cplusplus
extern "C" {
#endif
2017-10-19 19:40:58 +02:00
/**
* @brief Mask for @ref gnrc_mac_tx_feedback_t
*/
2017-11-16 18:06:46 +01:00
#define GNRC_NETIF_MAC_INFO_TX_FEEDBACK_MASK (0x0003U)
2017-10-19 19:40:58 +02:00
/**
* @brief Flag to track if a transmission might have corrupted a received
* packet
*/
2017-11-16 18:06:46 +01:00
#define GNRC_NETIF_MAC_INFO_RX_STARTED (0x0004U)
2017-10-19 19:40:58 +02:00
/**
* @brief Flag to track if a device has enabled CSMA for transmissions
*
* In case the device doesn't support on-chip CSMA and this flag is set for
* requiring CSMA transmission, then, the device will run software CSMA
* using `csma_sender` APIs.
*/
2017-11-16 18:06:46 +01:00
#define GNRC_NETIF_MAC_INFO_CSMA_ENABLED (0x0100U)
2017-10-19 19:40:58 +02:00
#if defined(MODULE_GNRC_LWMAC) || defined(MODULE_GNRC_GOMACH)
/**
* @brief Data type to hold MAC protocols
*/
typedef union {
#ifdef MODULE_GNRC_LWMAC
/**
* @brief LWMAC specific structure object for storing LWMAC internal states.
*/
gnrc_lwmac_t lwmac;
#endif
#ifdef MODULE_GNRC_GOMACH
/**
* @brief GoMacH specific structure object for storing GoMacH internal states.
*/
gnrc_gomach_t gomach;
#endif
} gnrc_mac_prot_t;
#endif
/**
2017-11-16 18:06:46 +01:00
* @brief @ref net_gnrc_mac component of @ref gnrc_netif_mac_t
*/
typedef struct {
2017-10-19 19:40:58 +02:00
/**
* @brief general information for the MAC protocol
*/
uint16_t mac_info;
/**
* @brief device's software CSMA configuration
*/
csma_sender_conf_t csma_conf;
#if ((GNRC_MAC_RX_QUEUE_SIZE != 0) || (GNRC_MAC_DISPATCH_BUFFER_SIZE != 0)) || DOXYGEN
/**
* @brief MAC internal object which stores reception parameters, queues, and
* state machines.
*
* @note Only available if @ref GNRC_MAC_RX_QUEUE_SIZE or
* @ref GNRC_MAC_DISPATCH_BUFFER_SIZE is greater than 0.
*/
gnrc_mac_rx_t rx;
#endif /* ((GNRC_MAC_RX_QUEUE_SIZE != 0) || (GNRC_MAC_DISPATCH_BUFFER_SIZE != 0)) || DOXYGEN */
#if ((GNRC_MAC_TX_QUEUE_SIZE != 0) || (GNRC_MAC_NEIGHBOR_COUNT != 0)) || DOXYGEN
/**
* @brief MAC internal object which stores transmission parameters, queues, and
* state machines.
*
* @note Only available if @ref GNRC_MAC_TX_QUEUE_SIZE or
* @ref GNRC_MAC_NEIGHBOR_COUNT is greater than 0.
*/
gnrc_mac_tx_t tx;
#endif /* ((GNRC_MAC_TX_QUEUE_SIZE != 0) || (GNRC_MAC_NEIGHBOR_COUNT == 0)) || DOXYGEN */
2017-10-19 19:40:58 +02:00
#if defined(MODULE_GNRC_LWMAC) || defined(MODULE_GNRC_GOMACH)
gnrc_mac_prot_t prot;
2017-10-19 19:40:58 +02:00
#endif
2017-11-16 18:06:46 +01:00
} gnrc_netif_mac_t;
#ifdef __cplusplus
}
#endif
2017-11-16 18:06:46 +01:00
#endif /* NET_GNRC_NETIF_MAC_H */
/** @} */