Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6074 from zhuoshuguo/gnrc_add_internal_mac_types
gnrc_mac: add mac tx and rx internal types.
- Loading branch information
Showing
12 changed files
with
890 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
* Copyright (C) 2015 Daniel Krebs | ||
* 2016 INRIA | ||
* | ||
* 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. | ||
*/ | ||
|
||
/** | ||
* @ingroup net_gnrc_mac | ||
* @{ | ||
* | ||
* @file | ||
* @brief Definitions of internal functions of GNRC_MAC module | ||
* @internal | ||
* @author Daniel Krebs <github@daniel-krebs.net> | ||
* @author Shuguo Zhuo <shuguo.zhuo@inria.fr> | ||
*/ | ||
|
||
#ifndef GNRC_MAC_INTERNAL_H_ | ||
#define GNRC_MAC_INTERNAL_H_ | ||
|
||
#include <stdint.h> | ||
#include <net/ieee802154.h> | ||
#include <net/gnrc/mac/types.h> | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#if (GNRC_MAC_TX_QUEUE_SIZE != 0) || defined(DOXYGEN) | ||
/** | ||
* @brief Queues the packet into the related transmission packet queue in netdev2_t::tx. | ||
* Note that, in case the `gnrc_mac_tx_neighbor_t` structure is in used (indicated | ||
* by `GNRC_MAC_NEIGHBOR_COUNT != 0`), this function queues the packet to | ||
* the queue associated to the pkt's destination neighbor, including a | ||
* `broadcast-neighbor` (neighbor id is `0` in netdev2_t::tx::neighbors) which | ||
* specifically stores broadcasting packets. | ||
* On the other hand, if `gnrc_mac_tx_neighbor_t` structure is not in used (indicated | ||
* by `GNRC_MAC_NEIGHBOR_COUNT == 0`), this function queues the packet into the single | ||
* priority TX queue defined in in netdev2_t::tx. | ||
* | ||
* @param[in,out] tx gnrc_mac transmission management object | ||
* @param[in] priority the priority of @p pkt | ||
* @param[in] pkt gnrc packet that will be queued | ||
* | ||
* @return true if queued successfully, otherwise false. | ||
*/ | ||
bool gnrc_mac_queue_tx_packet(gnrc_mac_tx_t* tx, uint32_t priority, gnrc_pktsnip_t* pkt); | ||
#endif /* (GNRC_MAC_TX_QUEUE_SIZE != 0) || defined(DOXYGEN) */ | ||
|
||
#if (GNRC_MAC_RX_QUEUE_SIZE != 0) || defined(DOXYGEN) | ||
/** | ||
* @brief Queues the packet into the reception packet queue in netdev2_t::rx. | ||
* | ||
* @param[in,out] rx gnrc_mac reception management object | ||
* @param[in] priority the priority of @p pkt | ||
* @param[in] pkt gnrc packet that will be queued | ||
* | ||
* @return true if queued successfully, otherwise false. | ||
*/ | ||
bool gnrc_mac_queue_rx_packet(gnrc_mac_rx_t* rx, uint32_t priority, gnrc_pktsnip_t* pkt); | ||
#endif /* (GNRC_MAC_RX_QUEUE_SIZE != 0) || defined(DOXYGEN) */ | ||
|
||
#if (GNRC_MAC_DISPATCH_BUFFER_SIZE != 0) || defined(DOXYGEN) | ||
/** | ||
* @brief Dispatch all the packets stored in netdev2_t::rx:dispatch_buffer to upper layer. | ||
* | ||
* @param[in,out] rx gnrc_mac reception management object | ||
*/ | ||
void gnrc_mac_dispatch(gnrc_mac_rx_t* rx); | ||
#endif /* (GNRC_MAC_DISPATCH_BUFFER_SIZE != 0) || defined(DOXYGEN) */ | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* GNRC_MAC_INTERNAL_H_ */ | ||
/** @} */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* Copyright (C) 2015 Daniel Krebs | ||
* 2016 INRIA | ||
* | ||
* 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. | ||
*/ | ||
|
||
/** | ||
* @defgroup net_gnrc_mac Common MAC module | ||
* @ingroup net_gnrc | ||
* @brief A MAC module for providing common MAC parameters and helper functions. | ||
* | ||
* @{ | ||
* | ||
* @file | ||
* @brief Definitions of GNRC_MAC | ||
* | ||
* @author Daniel Krebs <github@daniel-krebs.net> | ||
* @author Shuguo Zhuo <shuguo.zhuo@inria.fr> | ||
*/ | ||
|
||
#ifndef GNRC_MAC_H | ||
#define GNRC_MAC_H | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/** | ||
* @brief The default rx queue size for incoming packets | ||
*/ | ||
#ifndef GNRC_MAC_RX_QUEUE_SIZE | ||
#define GNRC_MAC_RX_QUEUE_SIZE (8U) | ||
#endif | ||
|
||
/** | ||
* @brief The default buffer size for storing dispatching packets | ||
*/ | ||
#ifndef GNRC_MAC_DISPATCH_BUFFER_SIZE | ||
#define GNRC_MAC_DISPATCH_BUFFER_SIZE (8U) | ||
#endif | ||
|
||
/** | ||
* @brief Count of neighbor nodes in one-hop distance | ||
*/ | ||
#ifndef GNRC_MAC_NEIGHBOR_COUNT | ||
#define GNRC_MAC_NEIGHBOR_COUNT (8U) | ||
#endif | ||
|
||
/** | ||
* @brief The default queue size for transmission packets coming from higher layers | ||
*/ | ||
#ifndef GNRC_MAC_TX_QUEUE_SIZE | ||
#define GNRC_MAC_TX_QUEUE_SIZE (8U) | ||
#endif | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* GNRC_MAC_H */ | ||
/** @} */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
MODULE = gnrc_mac | ||
|
||
include $(RIOTBASE)/Makefile.base |
Oops, something went wrong.