Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RIOT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cm-projects
RIOT
Commits
7565cd1d
"README.md" did not exist on "8fe7f6c7cf44964304c7f1e7931eeafae72b35e0"
Commit
7565cd1d
authored
7 years ago
by
zhuoshuguo
Browse files
Options
Downloads
Patches
Plain Diff
gnrc_mac: use software csma when needed.
parent
1934ae15
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Makefile.dep
+5
-0
5 additions, 0 deletions
Makefile.dep
sys/include/net/gnrc/netdev.h
+19
-0
19 additions, 0 deletions
sys/include/net/gnrc/netdev.h
sys/net/gnrc/link_layer/netdev/gnrc_netdev_ieee802154.c
+9
-0
9 additions, 0 deletions
sys/net/gnrc/link_layer/netdev/gnrc_netdev_ieee802154.c
with
33 additions
and
0 deletions
Makefile.dep
+
5
−
0
View file @
7565cd1d
...
@@ -13,6 +13,11 @@ ifneq (,$(filter csma_sender,$(USEMODULE)))
...
@@ -13,6 +13,11 @@ ifneq (,$(filter csma_sender,$(USEMODULE)))
USEMODULE
+=
xtimer
USEMODULE
+=
xtimer
endif
endif
ifneq
(,$(filter gnrc_mac,$(USEMODULE)))
USEMODULE
+=
gnrc_priority_pktqueue
USEMODULE
+=
csma_sender
endif
ifneq
(,$(filter nhdp,$(USEMODULE)))
ifneq
(,$(filter nhdp,$(USEMODULE)))
USEMODULE
+=
sock_udp
USEMODULE
+=
sock_udp
USEMODULE
+=
xtimer
USEMODULE
+=
xtimer
...
...
This diff is collapsed.
Click to expand it.
sys/include/net/gnrc/netdev.h
+
19
−
0
View file @
7565cd1d
...
@@ -38,6 +38,9 @@
...
@@ -38,6 +38,9 @@
#include
"net/gnrc/mac/types.h"
#include
"net/gnrc/mac/types.h"
#include
"net/ieee802154.h"
#include
"net/ieee802154.h"
#include
"net/gnrc/mac/mac.h"
#include
"net/gnrc/mac/mac.h"
#ifdef MODULE_GNRC_MAC
#include
"net/csma_sender.h"
#endif
#ifdef __cplusplus
#ifdef __cplusplus
extern
"C"
{
extern
"C"
{
...
@@ -66,6 +69,17 @@ extern "C" {
...
@@ -66,6 +69,17 @@ extern "C" {
*/
*/
#define GNRC_NETDEV_MAC_INFO_RX_STARTED (0x0004U)
#define GNRC_NETDEV_MAC_INFO_RX_STARTED (0x0004U)
/**
* @brief Flag to track if a device has enabled CSMA for transmissions
*
* If `gnrc_mac` is used, the user should be noticed that the `send()`
* function of gnrc_netdev will be affected with the state of this flag, since
* `gnrc_mac` accordingly adapts the `send()` function. If 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.
*/
#define GNRC_NETDEV_MAC_INFO_CSMA_ENABLED (0x0100U)
/**
/**
* @brief Structure holding GNRC netdev adapter state
* @brief Structure holding GNRC netdev adapter state
*
*
...
@@ -118,6 +132,11 @@ typedef struct gnrc_netdev {
...
@@ -118,6 +132,11 @@ typedef struct gnrc_netdev {
*/
*/
uint8_t
l2_addr_len
;
uint8_t
l2_addr_len
;
/**
* @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)) || defined(DOXYGEN)
#if ((GNRC_MAC_RX_QUEUE_SIZE != 0) || (GNRC_MAC_DISPATCH_BUFFER_SIZE != 0)) || defined(DOXYGEN)
/**
/**
* @brief MAC internal object which stores reception parameters, queues, and
* @brief MAC internal object which stores reception parameters, queues, and
...
...
This diff is collapsed.
Click to expand it.
sys/net/gnrc/link_layer/netdev/gnrc_netdev_ieee802154.c
+
9
−
0
View file @
7565cd1d
...
@@ -221,7 +221,16 @@ static int _send(gnrc_netdev_t *gnrc_netdev, gnrc_pktsnip_t *pkt)
...
@@ -221,7 +221,16 @@ static int _send(gnrc_netdev_t *gnrc_netdev, gnrc_pktsnip_t *pkt)
gnrc_netdev
->
dev
->
stats
.
tx_unicast_count
++
;
gnrc_netdev
->
dev
->
stats
.
tx_unicast_count
++
;
}
}
#endif
#endif
#ifdef MODULE_GNRC_MAC
if
(
gnrc_netdev
->
mac_info
&
GNRC_NETDEV_MAC_INFO_CSMA_ENABLED
)
{
res
=
csma_sender_csma_ca_send
(
netdev
,
vector
,
n
,
&
gnrc_netdev
->
csma_conf
);
}
else
{
res
=
netdev
->
driver
->
send
(
netdev
,
vector
,
n
);
}
#else
res
=
netdev
->
driver
->
send
(
netdev
,
vector
,
n
);
res
=
netdev
->
driver
->
send
(
netdev
,
vector
,
n
);
#endif
}
}
else
{
else
{
return
-
ENOBUFS
;
return
-
ENOBUFS
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment